diff options
Diffstat (limited to 'source/arduino/break.rst')
-rw-r--r-- | source/arduino/break.rst | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/arduino/break.rst b/source/arduino/break.rst new file mode 100644 index 0000000..d951c52 --- /dev/null +++ b/source/arduino/break.rst @@ -0,0 +1,28 @@ +.. _arduino-break: + +break +===== + +**break** is used to exit from a **do**, **for**, or **while** +loop, bypassing the normal loop condition. It is also used to exit +from a **switch** statement. + + + +Example +------- + +:: + + for (x = 0; x < 255; x ++) + { + digitalWrite(PWMpin, x); + sens = analogRead(sensorPin); + if (sens > threshold){ // bail out on sensor detect + x = 0; + break; + } + delay(50); + } + + |