Bram documentation.
This commit is contained in:
@@ -11,34 +11,34 @@ Then I came across a teaching site (https://www.codingkids.nl/arduino-buzzer.htm
|
|||||||
I watched a video about using Arduino and took a lot of op notes along the way.
|
I watched a video about using Arduino and took a lot of op notes along the way.
|
||||||
The link is: (https://www.youtube.com/watch?v=BLrHTHUjPuw).
|
The link is: (https://www.youtube.com/watch?v=BLrHTHUjPuw).
|
||||||
```
|
```
|
||||||
\/\/Arduino information:
|
// $Arduino information:
|
||||||
|
|
||||||
\/pinnumber(locatie, in-/output)
|
//pinnumber(locatie, in-/output)
|
||||||
|
|
||||||
\/digitalwrite(locatie, high/low)
|
//digitalwrite(locatie, high/low)
|
||||||
|
|
||||||
\/delay(time in millisec)
|
//delay(time in millisec)
|
||||||
|
|
||||||
\/int... <- variable
|
//int... <- variable
|
||||||
|
|
||||||
\/with a decimal its a double -> 1,2
|
//with a decimal its a double -> 1,2
|
||||||
|
|
||||||
\/a character is a char -> "a"
|
//a character is a char -> "a"
|
||||||
|
|
||||||
\/\/serial communications:
|
// $serial communications:
|
||||||
|
|
||||||
\/setup:
|
setup:
|
||||||
Serial.begin(9600) -> the text speed
|
Serial.begin(9600) -> the text speed
|
||||||
Serial.sprintLn(text)
|
Serial.sprintLn(text)
|
||||||
|
|
||||||
\/Loop:
|
Loop:
|
||||||
Serial.print("text")
|
Serial.print("text")
|
||||||
Serial.printLn(....) -> variable because no "
|
Serial.printLn(....) -> variable because no "
|
||||||
|
|
||||||
\/Ctrl + shift + M = serial monitor.
|
//Ctrl + shift + M = serial monitor.
|
||||||
The text speed needs to be the same as given.
|
The text speed needs to be the same as given.
|
||||||
|
|
||||||
\/\/If Statements:
|
// $If Statements:
|
||||||
|
|
||||||
if(condition){
|
if(condition){
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ if(condition){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\/&& = "and"
|
// && = "and"
|
||||||
|
|
||||||
\/|| = "or"
|
// || = "or"
|
||||||
|
|
||||||
\/\/For loops:
|
\/\/For loops:
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ For(int*i; i <= 10 ; i++){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\/The fading of led's:
|
// The fading of led's:
|
||||||
|
|
||||||
examples, basics, fade
|
examples, basics, fade
|
||||||
|
|
||||||
\/ servo's
|
// servo's
|
||||||
|
|
||||||
examples, servo, sweep
|
examples, servo, sweep
|
||||||
```
|
```
|
||||||
@@ -176,16 +176,18 @@ The code is short and simple:
|
|||||||
int button = 20;
|
int button = 20;
|
||||||
int buzzerone = 12;
|
int buzzerone = 12;
|
||||||
int buzzertwo = 11;
|
int buzzertwo = 11;
|
||||||
|
```
|
||||||
|
Now we set the pins up to either input or output a signal.
|
||||||
|
```
|
||||||
void setup() {
|
void setup() {
|
||||||
//put down some pins that will output , and some that input.
|
//put down some pins that will output , and some that input.
|
||||||
pinMode(button, INPUT);
|
pinMode(button, INPUT);
|
||||||
pinMode(buzzerone, OUTPUT);
|
pinMode(buzzerone, OUTPUT);
|
||||||
pinMode(buzzertwo, OUTPUT);
|
pinMode(buzzertwo, OUTPUT);
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
Here the button pin will seek a signal, when it is given it will send signals to the other given pins in he if-statement.
|
||||||
|
```
|
||||||
void loop() {
|
void loop() {
|
||||||
//read is there is input on the button pin, if so send output to the other pins, otherwise keep them off.
|
//read is there is input on the button pin, if so send output to the other pins, otherwise keep them off.
|
||||||
if(digitalRead(button) == HIGH){
|
if(digitalRead(button) == HIGH){
|
||||||
|
Reference in New Issue
Block a user