"Hold" or "pause" command/statement. Many statements. Mixing "if", "&&" and "||"


hi
i total newbie, , think hard understand "control structures" , when use curly baces more in beginning , @ end of scetch. tutorials or explenations?

my questions:

1:  how program "hold" or "pause" command/statement.. or workaround. ideas?  if "delay" delay whole loop!

2: how put more statements after each other? maximum 2 statements before";", or possible add more statements/commands ","?

3: possible mix "if", "else if", "else", &&(and) , || (or) ? limits/rules?

the case:

i have sensor, , when gets on threshold on input a0- want high output, , stay "high" until a0 senses input value above threshold , output "low". ideas write code?

void setup() {
  serial.begin(9600);
  pinmode (4, output);
}
void loop() {
int sensorvalue = analogread(a0);
  serial.println(sensorvalue);
   digitalwrite(4, high);
   if (sensorvalue > 360);

problems:  here should stay high until input above treshold representing...
   
   }


check out blink without delay example.


Arduino Forum > Using Arduino > Programming Questions > "Hold" or "pause" command/statement. Many statements. Mixing "if", "&&" and "||"


arduino

Comments

Popular posts from this blog

How do I add a forum to my site? - Joomla! Forum - community, help and support

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

List Control