User Tools

Site Tools


notes:c4eng:fall2023:projects:ptb2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
notes:c4eng:fall2023:projects:ptb2 [2023/10/26 03:22] mwinter4notes:c4eng:fall2023:projects:ptb2 [2023/10/26 03:25] (current) – [if-else] mwinter4
Line 16: Line 16:
 The if else statement essentially means that " __if__ this condition is true do the following thing, __else__ do this thing instead". If the condition inside the parentheses evaluates to true , the code inside the if block will execute. The if else statement essentially means that " __if__ this condition is true do the following thing, __else__ do this thing instead". If the condition inside the parentheses evaluates to true , the code inside the if block will execute.
  
 +An easy way to write an if statement that executes when our button is pressed, is just to simply combine functions: 
 +<code>
 +if(digitalRead(BUTTON)){
 +   //some code here//
 +}
 +</code>
 +With this method, there is no need to write out a full expression. You can simply evaluate within the if statement.
 =====staying within a range===== =====staying within a range=====
  
notes/c4eng/fall2023/projects/ptb2.1698290573.txt.gz · Last modified: 2023/10/26 03:22 by mwinter4