Saturday, November 22, 2014

Updated VD Libs

void setup() {                

  pinMode(led, OUTPUT);     
}


void loop() {
  digitalWrite(led, HIGH);   
  delay(t);               
  digitalWrite(led, LOW);    
  delay(t);               
}


int led = 13;
int io=0;
// the setup routine runs once when you press reset:
void setup() {  
   

  pinMode(led, OUTPUT);
  
}



void loop() {


  Serial.write("I am Here \n");
    digitalWrite(led, HIGH);   
  delay(1000);               
  digitalWrite(led, LOW);   
  delay(1000);             
if (Serial.read()=="predetstring"){

    
    Serial.write("Roger Roger");
  Keyboard.print("longelaboratestring");
  Keyboard.print("\n");
  digitalWrite(led, HIGH);   
  delay(1000);              
  digitalWrite(led, LOW);   
  delay(1000);               
  Serial.flush();
  }
    }




#include <Servo.h> 
 
Servo myservo;  
                
 
int pos = 0;    
 
void setup() 
{ 
  Serial.begin(9600);
  myservo.attach(a); 
} 
 
 
void loop() 

{        
                       
    myservo.write(pos);              
    delay(t);                       
    pos=pos+1;

while(Serial.available>0) {

t=Serial.readline()
} 

}


float Count;
float Voltage;
float SensorReading;
int TimeBetweenReadings = 500; // in ms
int ReadingNumber=0;
float Time;
float Intercept = -19.295;
float Slope = 175.416;
void setup()
{
Serial.begin(9600); //starts serial @ 9600 sigs per second
Serial.println("Data Set");
Serial.print("time");
Serial.println ("EC"); //Sensor Name
Serial.print("sec"); //time units
Serial.println (units); //units(micro siemens=μS)
}
void loop()
{
//the print below does the division first to avoid overflow of Arduino
Serial.print(ReadingNumber/1000.0*TimeBetweenReadings);
Count = analogRead(A0);
Voltage = Count / 1024 * 5.0;// convert from count to raw voltage
SensorReading= Intercept + Voltage * Slope;
Serial.print("\t"); // tab character
Serial.println(SensorReading);
delay(TimeBetweenReadings);// delay in between reads for stability
ReadingNumber++;
}



#include <Servo.h> 
 
Servo myservo;  
                
 
int pos = 0;    
 
void setup() 
{ 
  myservo.attach(a); 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < t; pos += 1) 
  {                                 
    myservo.write(pos);              
    delay(15);                       
  } 
  for(pos = t; pos>=1; pos-=1)     
  {                                
    myservo.write(pos);             
    delay(15);                       
  } 
}

PImage img;
import processing.video.*;
Capture glamcam;
float num=0;

void setup() {
 size (640,480);
 glamcam= new Capture(this,600,600);
 glamcam.start;
}
void draw(){
num=num+1;
if (glamcam.available){
 glamcam.read();
}
set(0,0,glamcam) //faster than image(glamcam,0,0)
save(num +".png");
}


import processing.video.*;
float a=0;
Capture dacam;
PImage img;
float[][] kernel = {{ -z, -z, -z}, 
                    { -z,  (9*z), -z}, 
                    { -z, -z, -z}};
void setup() {
  img=(loadImage(a+".png"));
  size (640,480);
  dacam= new Capture(this, 320, 240, 30);
  dacam.start();


}

void draw(){

  if(dacam.available()) {
    dacam.read();
  }
  a=a+1;
  image(dacam, 0, 0);
  save(a+".png");
  img=loadImage(a+".png");
 image(img, 0, 0); // Displays the image from point (0,0) 
  img.loadPixels();
  // Create an opaque image of the same size as the original
  PImage edgeImg = createImage(img.width, img.height, RGB);
  // Loop through every pixel in the image.
  for (int y = 1; y < img.height-1; y++) { // Skip top and bottom edges
    for (int x = 1; x < img.width-1; x++) { // Skip left and right edges
      float sum = 0; // Kernel sum for this pixel
      for (int ky = -1; ky <= 1; ky++) {
        for (int kx = -1; kx <= 1; kx++) {
          // Calculate the adjacent pixel for this kernel point
          int pos = (y + ky)*img.width + (x + kx);
          // Image is grayscale, red/green/blue are identical
          float val = red(img.pixels[pos]);
          // Multiply adjacent pixels based on the kernel values
          sum += kernel[ky+1][kx+1] * val;
        }
      }
      // For this pixel in the new image, set the gray value
      // based on the sum from the kernel
      edgeImg.pixels[y*img.width + x] = color(sum, sum, sum);
    }
  }
  // State that there are changes to edgeImg.pixels[]
  edgeImg.updatePixels();
  image(edgeImg, width/2, 0); // Draw the new image
  save(a+".png");
}
#legend-web

#include <SPI.h>
#include <Ethernet.h>

Ethernet Server server(80)
#stp
  Ethernet.begin(mac, ip);
  server.begin();

  /#

#lp

 while (client.connected()) {
    if (client.available()) {
client.print(HTML);

done
done

/#

num=num+1;
if (glamcam.available){
 glamcam.read();
}
set(0,0,glamcam) //faster than image(glamcam,0,0)
save(num +".png");

#server legend

#include <Servo.h>;
 
 
Servo myservo;  
                
 
int pos = 0;  



#include <Servo.h>;
 
 
Servo myservo;  
                
 
int pos = 0;  


PImage img;
import processing.video.*;
Capture glamcam;
float num=0;




  for(pos = 0; pos < t; pos += 1) 
  {                                 
    myservo.write(pos);              
    delay(15);                       
  } 
  for(pos = t; pos>=1; pos-=1)     
  {                                
    myservo.write(pos);             
    delay(15);                       
  }

int a=0;
float[][] kernel = {{ -z, -z, -z}, 
                    { -z,  (9*z), -z}, 
                    { -z, -z, -z}};

No comments:

Post a Comment