My lcd shield don't work with the virtual wire

64 views
Skip to first unread message

joao klinsmann

unread,
Jun 5, 2016, 3:09:01 PM6/5/16
to virtualwire

I was trying to use rx and lcd shield , but the LCD simply reduces its luster , I thought it was problem in code and when I shot the " vw_setup (2000); " it works okay, but I need it , anyone have any solutions ? follows the code:

#include <VirtualWire.h> #include <LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); double custo = 2.25; int pot = 25; void setup() { Serial.begin(9600); Serial.println("Recepcao modulo RF - Aguardando..."); lcd.begin(16,2); lcd.setCursor(0,0); lcd.println("Eletrodomestico "); vw_set_rx_pin(2); vw_setup(2000); vw_rx_start(); } void loop() { uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; lcd.display(); lcd.setCursor(0,1); lcd.print("Pot: "); lcd.setCursor(4,1); lcd.print(pot); lcd.setCursor(6,1); lcd.print("W"); lcd.setCursor(9,1); lcd.print("R$: "); if (vw_get_message(buf, &buflen)){ int i; digitalWrite(13, true); Serial.print("Recebido: "); for (i=0; i < buflen; i++){ Serial.print(buf[i], DEC); if (buf[i] > 99){ lcd.setCursor(7,1); lcd.print("W"); } lcd.setCursor(4,1); lcd.print(buf[i], DEC); lcd.setCursor(12,1); lcd.print(custo); delay(500); } Serial.println(""); digitalWrite(13,false); } }
Reply all
Reply to author
Forward
0 new messages