Arduino - dicas

2882 palavras 12 páginas
1. LCD

Direct plug in and program makes it work
Digital pin D10 is wired in for PWM control of LED backlight brightness
Only uses the A0 input line to read the 5 buttons
Other unused analog and digital lines are solder holes available to be wired in..

#include and define the interface pins with this statement: // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); You could also copy and paste the code from this link in the forums: http://club.dx.com/forums/forums.dx/threadid.1194279 as a test program. It reads the key you pressed (UP, DOWN, LEFT, RIGHT or SELECT), displays the analog voltage value associated with the key you pressed (or the lowest voltage if you pressed multiple keys) and allows you to adjust the LED backlight of the display and save the value in EEPROM so that the next time you power it up, it recalls that value.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("hello, world!");
}

void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000);
}

---- exemplo do deal extreme
The sketch below reads the buttons, displays the analog voltage for your board when it reads the buttons and displays what it thinks is the button you pressed. Additionally, it adjusts the backlight brightness through the PWM function on Pin 10 which controls the backlight. You can turn the ButtonVoltage read section into a function so it can be called from many places in your program. You can also write the fadeValue into EEPROM so you can save and recall the setting. If you do that, on reset, the

Relacionados

  • 006 Apostila Prof Raul Arduino Rev 01b
    13013 palavras | 53 páginas
  • Arduino
    15493 palavras | 62 páginas
  • trabalho tcc
    1551 palavras | 7 páginas
  • programação com arduino
    4005 palavras | 17 páginas
  • Robô aranha
    1410 palavras | 6 páginas
  • Voice Recognition V3
    1071 palavras | 5 páginas
  • arduino
    8394 palavras | 34 páginas
  • Arduino
    9111 palavras | 37 páginas
  • carrinho seguidor de trilha
    633 palavras | 3 páginas
  • Robótica
    1408 palavras | 6 páginas