Controle USB: Utilizando Arduino Com VB 2010
Controle USB: Utilizando Arduino Com VB 2010
Plataforma Arduino
Plataforma Arduino
PC
USB
Microcontrolador
Pinos 0 e 1
Arduino - Tipos
Arduino - Programao
Estruturas
Void Setup
Informa ao uC as entradas e sadas utilizadas
Void Loop
Programa de analise e escrita das
entradas/sadas
Arduino - Programao
Estruturas de Deciso
if (x > 120){
digitalWrite(LEDpin1, HIGH);
digitalWrite(LEDpin2, HIGH);
}
x == y (x is equal to y)
x != y (x is not equal to y)
x < y (x is less than y)
x > y (x is greater than y)
x <= y (x is less than or equal to y)
x >= y (x is greater than or equal to y)
Arduino - Programao
if (pinFiveInput < 500) {
// do Thing A
} else {
// do Thing C
Arduino - Programao
for (int i=0; i <= 255; i++){
analogWrite(PWMpin, i);
delay(10);
Arduino - Programao
switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
Arduino - Programao
var = 0;
while(var < 200){
// do something repetitive 200 times
var++;
Arduino - Programao
do {
delay(50);
// wait for sensors to stabilize
x = readSensors();
// check the sensors
}
void loop()
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000);// waits for a second
digitalWrite(ledPin, LOW);// sets the LED off
delay(1000);// waits for a second
}
void loop()
{
val = digitalRead(inPin); // read the input pin
digitalWrite(ledPin, val); // sets the LED to the button's value