Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
logiciels:serial-processing:accueil [2016/05/25 10:25] resonance [Code Arduino] |
logiciels:serial-processing:accueil [2018/01/22 11:19] resonance ancienne révision (2016/05/25 10:28) restaurée |
||
---|---|---|---|
Ligne 69: | Ligne 69: | ||
void draw() { | void draw() { | ||
+ | |||
+ | // Draw circles | ||
fill(# | fill(# | ||
ellipse(x, v1, 5, 5); | ellipse(x, v1, 5, 5); | ||
- | | ||
fill(# | fill(# | ||
ellipse(x, v2, 5, 5); | ellipse(x, v2, 5, 5); | ||
+ | // Update x position | ||
x++; | x++; | ||
- | //v1++; | ||
- | //v2--; | ||
| | ||
// Refresh screen | // Refresh screen | ||
Ligne 84: | Ligne 84: | ||
x = 0; | x = 0; | ||
} | } | ||
- | | ||
- | //if (v2 < 0) v2 = 255; | ||
- | //if (v1 >255) v1 = 0; | ||
} | } | ||
Ligne 93: | Ligne 90: | ||
// method in the setup(): | // method in the setup(): | ||
void serialEvent(Serial myPort) { | void serialEvent(Serial myPort) { | ||
+ | |||
// read the serial buffer: | // read the serial buffer: | ||
String myString = myPort.readStringUntil(' | String myString = myPort.readStringUntil(' | ||
+ | | ||
// if you got any bytes other than the linefeed: | // if you got any bytes other than the linefeed: | ||
myString = trim(myString); | myString = trim(myString); | ||
+ | | ||
// split the string at the commas | // split the string at the commas | ||
// and convert the sections into integers: | // and convert the sections into integers: |