start:arduino:vl53lxxv2
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| start:arduino:vl53lxxv2 [2024/03/25 10:45] – gerardadmin | start:arduino:vl53lxxv2 [2024/03/25 11:04] (Version actuelle) – [code Robot Tourne] gerardadmin | ||
|---|---|---|---|
| Ligne 54: | Ligne 54: | ||
| ====Programme Arduino/ | ====Programme Arduino/ | ||
| + | ==Bibliotheque Adafruit_VL53L0X== | ||
| + | [[https:// | ||
| Ligne 104: | Ligne 106: | ||
| </ | </ | ||
| + | == code Robot Tourne == | ||
| + | |||
| + | <code c Robottourne.ino> | ||
| + | #include " | ||
| + | |||
| + | Adafruit_VL53L0X lox = Adafruit_VL53L0X(); | ||
| + | int distanceR = 0; | ||
| + | void setup() | ||
| + | { | ||
| + | Serial.begin(115200); | ||
| + | |||
| + | // wait until serial port opens for native USB devices | ||
| + | while (! Serial) | ||
| + | { | ||
| + | delay(1); | ||
| + | } | ||
| + | |||
| + | Serial.println(" | ||
| + | if (!lox.begin()) | ||
| + | { | ||
| + | Serial.println(F(" | ||
| + | while(1); | ||
| + | } | ||
| + | // power | ||
| + | Serial.println(F(" | ||
| + | } | ||
| + | void deplacementRobot()// | ||
| + | // | ||
| + | |||
| + | { | ||
| + | if ( distanceR >= 200) | ||
| + | { Serial.println(" | ||
| + | if ( distanceR <=40) | ||
| + | { Serial.println(" | ||
| + | } | ||
| + | |||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | VL53L0X_RangingMeasurementData_t measure; | ||
| + | |||
| + | // | ||
| + | lox.rangingTest(& | ||
| + | |||
| + | if (measure.RangeStatus != 4) | ||
| + | { // phase failures have incorrect data | ||
| + | distanceR = measure.RangeMilliMeter; | ||
| + | // | ||
| + | deplacementRobot(); | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | // | ||
| + | } | ||
| + | |||
| + | delay(100); | ||
| + | } | ||
| + | </ | ||
/home/chanteri/www/fablab37110/data/attic/start/arduino/vl53lxxv2.1711359915.txt.gz · Dernière modification : de gerardadmin
