Yes, those are the audio-video cables which were so popular in the 90's, and they are wired directly into the hat. I will be posting more of the details on finished product later, I need to pick up some op amps for the final wires, the signal fidelity is obviously always a problem, especially at such low power. Anyway, if you choose to just go ahead with it, then ground thyself to prevent uncomfortable metal-skin contact if you wire your intake up with a ground(microchip side).
int sensorPin = A0; float sensorValue = 0; void setup() { Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); if(sensorValue!=0.00){ delay(22); if((sensorValue/22)>300){ Serial.println(("10")); }else{ sensorValue = analogRead(sensorPin); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); sensorValue=(sensorValue+analogRead(sensorPin)); if(sensorValue/22>300){ Serial.println("70"); } } sensorValue=0; } }
Okay, this is the Computer(display) side:
int a=1; import processing.serial.*; Serial myPort; // The serial port int xPos = 1; // horizontal position of the graph void setup () { // set the window size: size(600, 600); // List all the available serial ports println(Serial.list()); // I know that the first port in the serial list on my mac // is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[0], 9600); // don't generate a serialEvent() unless you get a newline character: myPort.bufferUntil('\n'); // set inital background: background(0); } void draw () { // everything happens in the serialEvent() } void serialEvent (Serial myPort) { // get the ASCII string: String inString = myPort.readStringUntil('\n'); if (inString != null) { // trim off any whitespace: inString = trim(inString); // convert to an int and map to the screen height: float inByte = float(inString); inByte = map(inByte, 0, 1023, 0, height); // draw the line: stroke(127,34,255); line(xPos, height, xPos, height - inByte); // at the edge of the screen, go back to the beginning: if (xPos &rt;= width) { //save(a+".png"); a=a+1; xPos = 0; background(0); } else { // increment the horizontal position: xPos=xPos+2; } } }
No comments:
Post a Comment