Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* +-----+
- +----[PWR]-------------------| USB |--+
- | +-----+ |
- | GND/RST2 [ ][ ] |
- | MOSI2/SCK2 [ ][ ] A5/SCL[ ] |
- | 5V/MISO2 [ ][ ] A4/SDA[ ] |
- | AREF[ ] |
- | GND[ ] |
- | [ ]N/C SCK/13[ ] | Sensores
- | [ ]IOREF MISO/12[ ] | ----------/ ------- GND
- | [ ]RST MOSI/11[ ]~| ----------/ ------- GND
- | [ ]3V3 +---+ 10[ ]~| ----------/ ------- GND
- | [ ]5v -| A |- 9[ ]~|
- | [ ]GND -| R |- 8[ ] |
- | [ ]GND -| D |- |
- | [ ]Vin -| U |- 7[ ] |
- | -| I |- 6[ ]~| ----------|<|--------RRRRRR------+5V
- | [ ]A0 -| N |- 5[ ]~| ----------|<|--------RRRRRR------+5V
- | [ ]A1 -| O |- 4[ ] | ----------|<|--------RRRRRR------+5V
- | [ ]A2 +---+ INT1/3[ ]~| LEDs +-1k2
- | [ ]A3 INT0/2[ ] |
- | [ ]A4/SDA RST SCK MISO TX>1[ ] |
- | [ ]A5/SCL [ ] [ ] [ ] RX<0[ ] |
- | [ ] [ ] [ ] |
- | UNO_R3 GND MOSI 5V ____________/
- \_______________________/
- */
- int ledV = 4; // 1; define led verde no pino 1
- int ledA = 5; // 2 ;
- int ledVM = 6; // 3 ;
- int ss1 = 10; // 4; define sensor no pino 4
- int ss2 = 11; // 5;
- int ss3 = 12; // 6;
- //---------------------------
- void setup() { //Configura parâmetros
- pinMode(ledV, OUTPUT); //Ports LEDs como saidas
- pinMode(ledA, OUTPUT);
- pinMode(ledVM, OUTPUT);
- pinMode(ss1, INPUT_PULLUP); //Pullup
- pinMode(ss2, INPUT_PULLUP); //Pullup
- pinMode(ss3, INPUT_PULLUP); //Pullup
- digitalWrite(ledV, LOW); // Acende o led verde
- digitalWrite(ledA, HIGH); // Apaga o led Amarelo
- digitalWrite(ledVM, HIGH); // Apaga o led Vermelho
- }
- //---------------------------
- void loop() { //Programa principal
- if (digitalRead(ss1) == 0)
- {
- digitalWrite(ledV, HIGH); // Apaga o led verde
- digitalWrite(ledA, LOW); // Acende o led amarelo
- delay(500); // delay 500 ms
- digitalWrite(ledA, HIGH); // Apaga o led amarelo
- digitalWrite(ledVM, LOW); // Acende o led Vermelho
- }
- if (digitalRead(ss3) == 0)
- {
- digitalWrite(ledV, LOW); // Acende o led verde
- digitalWrite(ledA, HIGH); // Apaga o led amarelo
- digitalWrite(ledVM, HIGH); // Apaga o led Vermelho
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement