adding readme
parent
c39e05d6c1
commit
ef4e54d443
@ -0,0 +1,76 @@
|
||||
# Introduction
|
||||
|
||||
# Basic
|
||||
|
||||
## Digital outputs
|
||||
|
||||
```c
|
||||
#include <Arduino.h>
|
||||
// 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 <Arduino.h>
|
||||
// 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 <Arduino.h>
|
||||
// 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);
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue