hi
i am new here in programming so for my project i paid some one and purchase code from him , i have good knowlege of pcb schematic so no problem in conection
i am sending code here please check it in your arduino and tell me its working or not , because from my site no output in serial monitor and lcd
programmer says that u have wrong swich conection but i am 100% sure that its correct because i test swich inbuilt programm called button when i press swich led goes on
by the way experts plz check code and tell me its work on your device or not #include <Wire.h> #include <EEPROM.h> #include <LiquidCrystal_I2C.h> #define COUNTVALUE 10
LiquidCrystal_I2C lcd(0x27, 16, 2);
int buttonPin = 3;
int flag;
int buttonState;
int lastcntvalue = 0;
How is your switch wired up? The code produces output when digitalRead returns LOW, so you should have a pullup resistor. I'd expect the code to have used INPUT_PULLUP instead of INPUT in the pinmode call.
That it doesn't implies that you're providing an external pullup. Are you?
wildbill:
How is your switch wired up? The code produces output when digitalRead returns LOW, so you should have a pullup resistor. I'd expect the code to have used INPUT_PULLUP instead of INPUT in the pinmode call.
That it doesn't implies that you're providing an external pullup. Are you?
i tried INPUT_PULLUP nstead of INPUT in the pinmode call. but same nothing on serial monitor
Your contractor needs his arse kicked for the lack of comments....
cdma-india:
i tried INPUT_PULLUP nstead of INPUT in the pinmode call. but same nothing on serial monitor
If you had it wired according to the schematic you linked, did you remove the external pulldown resistor, and rewire the button so it's from pin to ground not pin to 5V?
I am not able to test your program, and I am not sure what it should do....
But start checking the basics.
Button must be connected to pin 3. Check with a DMM the pin 3 has 0V when button is pressed, and 5V when not.
Regarding serial monitor, use same baud rate as in Serial.begin() in setup().
'lastcntvalue' is read from EEPROM at startup, and the if-condition does not handle values above 'COUNTVALUE' it will end up with 'while(1);' and do nothing.