-
GAMEPOD.hu
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
olli
tag
Sziasztok!
Energia mérőhöz az eredeti programban nyomógombos lcd szerepel, a gombokkal kalibrál. Az lcd az A0 lábon csatlakozik./* 0.1- Button Function */
int buttonRead;
buttonRead = analogRead (0); // Read analog pin A0. Pin A0 automatically assigned for LCD Display Button function (cannot be changed)
currentButtonMillis = millis();
if(currentButtonMillis - startButtonMillis >= 300)
{
//Right button is pressed
if (buttonRead < 60)
{
myGLCD.clrScr(); // Clear the screen (black)
myGLCD.setFont(BigFont);
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 255);
myGLCD.print ("PRESS <SELECT> ",20,20);
myGLCD.print ("TO CALLIBRATE ",20,50);
}
// Up button is pressed
if (buttonRead < 200 && buttonRead > 60) // Press up button to go to upper page
{
page = page - 1 ;
if( page <=0)
{ page = 1;}
startButtonMillis = millis();
}
// Down button is pressed
if (buttonRead < 400 && buttonRead > 200) // Press down button to go to lower page
{
page = page + 1;
if (page >3)
{ page = 3;
}
startButtonMillis = millis();
}
// Left button is pressed
if (buttonRead < 600 && buttonRead >400)
{
myGLCD.clrScr(); // Clear the screen (black)
myGLCD.setFont(BigFont);
myGLCD.setColor(0, 0, 255);
myGLCD.setBackColor(0, 0, 255);
myGLCD.print ("PRESS <SELECT> ",20,20);
myGLCD.print ("TO CALLIBRATE ",20,50);
}
// Select button is pressed
if (buttonRead < 800 && buttonRead > 600)
{
currentOffsetRead = 1; // to activate offset for current
voltageOffsetRead = 1; // to activate offset for voltage
powerOffsetRead = 1; // to activate offset for power // set display words starting at upper left corner
myGLCD.print ("INITIALIZING..... ",20,120); // set display words starting at lower left corner
myGLCD.print ("WAIT 5 SEC ..... ",20,150);
}
}
A nyomógombos lcd hiányában kihagyható: // Offset will automatically callibrate when SELECT Button on the LCD Display Shield is pressed.
// If you do not have LCD Display Shield, look into serial monitor to add or minus the value manually and key in here.
Pontosan hogyan tudom módosítani az értéket?
Érintő képernyő + mega 2560 lesz az alap hardwer, az érintőképernyő
gombjaival ki lehet váltani a fizikai gombokat?
Pl. megoldás egy pwm lábon kiadni a feszültség szinteket az A0 lábra?By cool !