Tuesday, October 14, 2014

UUV "Flying Fish" Prototype

Requires 6 additional thrusters and 4 signal paths as there is no onboard comp for a serial conn as of now. Built for speed and maneuverability.

OpenSCAD code for stabilizing fins(not shown):



a=10;
b=.01;
module tri(s){
linear_extrude(height = b)
scale([.3,1,10])
polygon(
points=[[0,10],[5*s+b,0],[-5*s-b,0]],
paths=[[0,1,2]]
);
}
for(i=[0:1/a:1-1/a]){
hull(){
translate([0,0,10*(i)])tri(1-i);
translate([0,0,10*(i+1/a)])tri(1-i-1/a);
translate([0,0,10*(i)])tri(1-i);
translate([0,0,-10*(i+1/a)])tri(1-i-1/a);
}
}
Which produces:

or view it online at 3dViewerOnline




Signal wire, stripped to decrease turn radius and p factor during turn


Friday, October 10, 2014

Cftp




#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
const int sd_cs = 4;
const int ethernet_cs = 10;
long interval = 200000;
long previousMillis = 0;
byte mac[] = {
 UP to YOU };
IPAddress ip(DEPENDS);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
File myFile;
char data [] = "";
void setup() {
 // Open serial communications and wait for port to open:
 Serial.begin(9600);

 pinMode(sd_cs, OUTPUT);
 pinMode(ethernet_cs, OUTPUT);
 Ethernet.begin(mac, ip);
 server.begin();
 Serial.print("Init Serv @ ");
 Serial.println(Ethernet.localIP());
 digitalWrite(ethernet_cs, HIGH);
 digitalWrite(sd_cs, LOW);
 if (!SD.begin(4)) {
   Serial.println("initialization failed!");
   return;
 }
 Serial.println("initialization done.");
 myFile = SD.open("temps.txt", FILE_WRITE);
 myFile.close();
}


void loop() {

 checkClient();
 unsigned long currentMillis = millis();

 if(currentMillis - previousMillis > interval) {

   previousMillis = currentMillis;
   recordConditions();

 }

}

void checkClient()  // listen for incoming clients
{
 digitalWrite(ethernet_cs, LOW);
 digitalWrite(sd_cs, HIGH);
 EthernetClient client = server.available();
 if (client) {
   Serial.println("new client");
   // an http request ends with a blank line
   boolean currentLineIsBlank = true;
   while (client.connected()) {
     if (client.available()) {
       char c = client.read();
       Serial.write(c);
       // if you've gotten to the end of the line (received a newline
       // character) and the line is blank, the http request has ended,
       // so you can send a reply
       if (c == '\n' && currentLineIsBlank) {
         // send a standard http response header
         client.println("HTTP/1.1 200 OK");
         client.println("Content-Type: text/html");
         client.println("Connnection: close");
         client.println();
         client.println("<!DOCTYPE HTML>");
         client.println("<html>");
         // add a meta refresh tag, so the browser pulls again every 5 seconds:
         client.println("<meta http-equiv=\"refresh\" content=\"5\">");
         digitalWrite(ethernet_cs, HIGH);
         digitalWrite(sd_cs, LOW);
         myFile = SD.open("temps.txt");
         if (myFile) {
           Serial.println("temps.txt:");

           // read from the file until there's nothing else in it:
           while (myFile.available()) {

             char data = myFile.read();

             digitalWrite(ethernet_cs, LOW);
             digitalWrite(sd_cs, HIGH);
             client.print(data);
             Serial.write(data);

           }
           // close the file:
           digitalWrite(ethernet_cs, HIGH);
           digitalWrite(sd_cs, LOW);
           myFile.close();
         }
         else {
           // if the file didn't open, print an error:
           Serial.println("error opening test.txt");
         }
         digitalWrite(ethernet_cs, LOW);
         digitalWrite(sd_cs, HIGH);
         client.println(" done");
         Serial.println(" done");
         client.println("<br />");
         client.println("</html>");
         break;
       }
       if (c == '\n') {
         // you're starting a new line
         currentLineIsBlank = true;
       }
       else if (c != '\r') {
         // you've gotten a character on the current line
         currentLineIsBlank = false;
       }
     }
   }
   // give the web browser time to receive the data
   delay(1);
   // close the connection:
   client.stop();
   Serial.println("client disonnected");
 }
}

}


Thursday, October 9, 2014

JBrowse


Java runtime for additional browser for VD forum browsing and some other features

Wednesday, October 1, 2014

Crt build stage 1


ISPT Overview

Imports System.Text
Imports System.IO


Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Enabled = True

    End Sub
    Sub Main()
        Dim s As String = "ABCDEFGHIJKLMNOPQURSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
        Dim r As New Random


        Dim sb As New StringBuilder
        For i As Integer = 1 To (Int.Text)
            Dim idx As Integer = r.Next(0, 62)
            sb.Append(s.Substring(idx, 1))
            TextBox1.Text = sb.ToString


        Next

    End Sub


    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Button1.Focus()
        Main()

        WebBrowser1.Document.GetElementById("email").SetAttribute("value", (TextBox1.Text) + "@gmail.com")
        WebBrowser1.Document.GetElementById("pass").SetAttribute("value", "password")
        WebBrowser1.Document.GetElementById("u_0_h").InvokeMember("click")
        WebBrowser1.Refresh()
        WebBrowser1.Navigate(TextBox2.Text)
        WebBrowser1.Navigate(TextBox3.Text)
        WebBrowser1.Document.GetElementById("email").SetAttribute("value", (TextBox1.Text) + "@gmail.com")
        WebBrowser1.Document.GetElementById("pass").SetAttribute("value", "password")
        WebBrowser1.Document.GetElementById("u_0_h").InvokeMember("click")
        Dim file As System.IO.StreamWriter
        file = My.Computer.FileSystem.OpenTextFileWriter("C:/Users/Desktop/9.txt", True)
        file.WriteLine(TextBox1.Text)
        file.Close()
        WebBrowser1.Refresh()
        WebBrowser1.Navigate(TextBox2.Text)
        WebBrowser1.Navigate(TextBox3.Text)
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        Timer2.Enabled = False
        Timer3.Enabled = False
        Open.Enabled = False


    End Sub


    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Timer1.Enabled = False

    End Sub

    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
        Timer1.Enabled = True
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Timer2.Enabled = True
        Timer3.Enabled = True
    End Sub

    Private Sub Open_Tick(sender As Object, e As EventArgs) Handles Open.Tick
        Dim ret As Object
        ret = Shell("C:\Users\Desktop\Execution\Brown.bat")
        Close()
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Open.Enabled = True
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


    End Sub

End Class

Open Biolistics Robotic Microcope Code

PrintWriter output;
String one[]=loadStrings("lines.txt"); //this histogram is made when the tissue is first placed
String two[]=loadStrings("dvals.txt");// txt file displaying histogram values
int a=0;
size(640, 360);
PrintWriter ouput;
PImage histoimg;
image(img, 0, 0);
int[] hist = new int[256];
ouput= createWriter("dvals.txt");
import processing.video.*;
Capture dacam;
PImage img;
void setup() {
  output = createWriter("aggregator.txt"); 
  img=(loadImage(a+".png"));
  size (640,480);
  dacam= new Capture(this, 320, 240, 30);
  dacam.start();
}
void draw() {
 if(dacam.available()) {
    dacam.read();
  }
  image(dacam, 0, 0);
 image(img, 0, 0);
 save("histoimg"+".png");
for (int i = 0; i < histoimg.width; i++) {
  for (int j = 0; j < histoimg.height; j++) {
    int bright = int(brightness(get(i, j)));
    hist[bright]++; 
    ouput.println(bright);
  }
}
}
void loop() {
float r=0;
  println(one.length);
  println(two.length);
  for( int t=0;r<one.length;r++){
    if(one[t] != two[t]) {
    a=a+1;
    if(a&rt;((dacam.width*dacam.height)/700){
      textSize(50);
     text("MOVEMENT DETECTED",10,40); // lines 8 through 11 check for a Δ between dvals and lines, if there is a difference it will alert the users 
     start("dart exe file here");
     output.println("1");
     output.close();
     a=0;
     }
}
}
}


I wrote a post earlier that explains the dart exe file.