560
edits
Betulpeker (talk | contribs) No edit summary |
Betulpeker (talk | contribs) No edit summary |
||
Line 39: | Line 39: | ||
background (255); // make a white background. You can also put this in DRAW to refresh your canvas every draw loop. | background (255); // make a white background. You can also put this in DRAW to refresh your canvas every draw loop. | ||
} | } | ||
void draw() { | void draw() { | ||
//*** experiment here to visualize your sensor data! | //*** experiment here to visualize your sensor data! | ||
//*** use the variable – rawSensorData – to change things according to sensor changes. | //*** use the variable – rawSensorData – to change things according to sensor changes. | ||
// for example: | // for example: | ||
//float mappedData = map (rawSensorData, 0, 1023, 0, 255); | //float mappedData = map (rawSensorData, 0, 1023, 0, 255); | ||
background (r,g,b); | background (r,g,b); | ||
} | } | ||
// this is the serial function that runs constantly in the background of your program | // this is the serial function that runs constantly in the background of your program | ||
// it allows you to use the incoming data in the draw() function, you do not need to change this. | // it allows you to use the incoming data in the draw() function, you do not need to change this. | ||
Line 61: | Line 57: | ||
println (incomingData); | println (incomingData); | ||
myPort.clear(); // clear the serial port for receiving new data | myPort.clear(); // clear the serial port for receiving new data | ||
} | } | ||
/* | /* | ||
HELP: FINDING THE CORRECT USB PORT | HELP: FINDING THE CORRECT USB PORT | ||
if you can not find your arduino USB port, make a new file and add this code: | if you can not find your arduino USB port, make a new file and add this code: | ||
* CODE START * | * CODE START * | ||
import processing.serial.*; | import processing.serial.*; | ||
Line 73: | Line 66: | ||
printArray(Serial.list()); | printArray(Serial.list()); | ||
* CODE END * | * CODE END * | ||
It will print out a list of all your USB connections. | It will print out a list of all your USB connections. | ||
Find the [ ] number for your Arduino Port and include it in line 8 of this code. | Find the [ ] number for your Arduino Port and include it in line 8 of this code. | ||
*/ | */ |
edits