diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..d1c6f74 --- /dev/null +++ b/Readme.md @@ -0,0 +1,76 @@ +# Introduction + +# Basic + +## Digital outputs + +```c +#include +// vars and pins +const int led = 9; + +void setup() { + // put your setup code here, to run once: + pinMode(led, OUTPUT); +} + +void loop() { + // put your main code here, to run repeatedly: + digitalWrite(led, LOW); + delay(500); + digitalWrite(led, HIGH); + delay(500); +} +``` + +## PWM outputs + +```c +#include +// vars and pins +const int led = 9; + +void setup() { + // put your setup code here, to run once: + pinMode(led, OUTPUT); + Serial.begin(9600); +} + +void loop() { + // put your main code here, to run repeatedly: + Serial.print("pwm on\n"); + for(int pwm=0; pwm<=255; pwm+=5){ + analogWrite(led, pwm); + delay(50); + } +Serial.print("pwm off\n"); +for(int pwm=255; pwm>=0; pwm-=5){ + analogWrite(led, pwm); + delay(50); + } +} +``` + +## Analog readings + +```c +#include +// vars and pins +const int led = 9; +const int T2 = A2; +int T2Val; + +void setup() { + // put your setup code here, to run once: + //pinMode(led, OUTPUT); + Serial.begin(9600); +} + +void loop() { + // put your main code here, to run repeatedly: + T2Val = analogRead(T2); + Serial.print("ADC: "); + Serial.println(T2Val); + delay(100); +} +```