MEGA 2560
No takto chcem vypalit ten bootloader, len prave ten USB ISP Programator na to potrebujem. Bez toho programatora to len tak nevypalim.packa píše:hele ještě je tam přímo v prostředí arduina záložka v nástroje : vypálit zavaděč tak to prubni pokud to proběhne tak bys to měl mít ok
Tak arduino uz bezi..
Mam dalsi problem, ze mam na neho pripojeny dotykovy display a neviem ako vyvolat dalsie menu na displey.
Mam ako keby prve menu kde mam 6 tlacidla a chcem po stlaceni prveho tlacidla, aby mi zobrazilo dalsie menu, kde je klavesnica s cislami od 1-10 + enter a clear.
Po zadani hodnoty, aby mi ju zapisalo do pola a aby som tu hodnotu mohol pouzit pre dalsi program kde bude pocitat s touto hodnotou.
Prikladam program
Mam dalsi problem, ze mam na neho pripojeny dotykovy display a neviem ako vyvolat dalsie menu na displey.
Mam ako keby prve menu kde mam 6 tlacidla a chcem po stlaceni prveho tlacidla, aby mi zobrazilo dalsie menu, kde je klavesnica s cislami od 1-10 + enter a clear.
Po zadani hodnoty, aby mi ju zapisalo do pola a aby som tu hodnotu mohol pouzit pre dalsi program kde bude pocitat s touto hodnotou.
Prikladam program
Kód: Vybrat vše
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t Dingbats1_XL[];
// Set up UTFT...
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : <display model>,19,18,17,16
// Standard Arduino Mega/Due shield : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due : <display model>,25,26,27,28
// Standard chipKit Uno32/uC32 : <display model>,34,35,36,37
// Standard chipKit Max32 : <display model>,82,83,84,85
// AquaLEDSource All in One Super Screw Shield : <display model>,82,83,84,85
// CC3200 LaunchPad (pins used in the examples): <display model>,15,18,11,32
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,38,39,40,41);
// Set up UTouch...
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino 2009/Uno/Leonardo shield : 15,10,14,9,8
// Standard Arduino Mega/Due shield : 6,5,4,3,2
// CTE TFT LCD/SD Shield for Arduino Due : 6,5,4,3,2
// Standard chipKit Uno32/uC32 : 20,21,22,23,24
// Standard chipKit Max32 : 62,63,64,65,66
// AquaLEDSource All in One Super Screw Shield : 62,63,64,65,66
// CC3200 LaunchPad (pins used in the examples): 31,13,19,28,17
//
UTouch myTouch(6,5,4,3,2);
// Finally we set up UTFT_Buttons :)
UTFT_Buttons myButtons(&myGLCD, &myTouch);
/////////////////////////////////////////////
//Nova klavesnica
/////////////////////////////////////////////
extern uint8_t BigFont[];
int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";
/*************************
** Custom functions **
*************************/
void drawButtons()
{
// Draw the upper row of buttons
for (x=0; x<5; x++)
{
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60);
myGLCD.printNumI(x+1, 27+(x*60), 27);
}
// Draw the center row of buttons
for (x=0; x<5; x++)
{
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120);
if (x<4)
myGLCD.printNumI(x+6, 27+(x*60), 87);
}
myGLCD.print("0", 267, 87);
// Draw the lower row of buttons
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (10, 130, 150, 180);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (10, 130, 150, 180);
myGLCD.print("Clear", 40, 147);
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (160, 130, 300, 180);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (160, 130, 300, 180);
myGLCD.print("Enter", 190, 147);
myGLCD.setBackColor (0, 0, 0);
}
void updateStr(int val)
{
if (stCurrentLen<20)
{
stCurrent[stCurrentLen]=val;
stCurrent[stCurrentLen+1]='\0';
stCurrentLen++;
myGLCD.setColor(0, 255, 0);
myGLCD.print(stCurrent, LEFT, 224);
}
else
{
myGLCD.setColor(255, 0, 0);
myGLCD.print("BUFFER FULL!", CENTER, 192);
delay(500);
myGLCD.print(" ", CENTER, 192);
delay(500);
myGLCD.print("BUFFER FULL!", CENTER, 192);
delay(500);
myGLCD.print(" ", CENTER, 192);
myGLCD.setColor(0, 255, 0);
}
}
// Draw a red frame while a button is touched
void waitForIt(int x1, int y1, int x2, int y2)
{
myGLCD.setColor(255, 0, 0);
myGLCD.drawRoundRect (x1, y1, x2, y2);
while (myTouch.dataAvailable())
myTouch.read();
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (x1, y1, x2, y2);
}
////////////////////////////////////////////////////////////////////////
void setup()
{
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setFont(BigFont);
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
myButtons.setTextFont(BigFont);
myButtons.setSymbolFont(Dingbats1_XL);
}
void loop()
{
int but1, but2, but3, but4, butX, butY, pressed_button;
boolean default_colors = true;
but1 = myButtons.addButton( 10, 20, 130, 30, "Rychlost");
but2 = myButtons.addButton( 10, 60, 130, 30, "Uhol");
but3 = myButtons.addButton( 10, 100, 130, 30, "Pocet");
but4 = myButtons.addButton( 10, 140, 130, 30, "Vymaz", BUTTON_DISABLED);
butX = myButtons.addButton(279, 199, 40, 40, "a", BUTTON_SYMBOL); // tlacidlo spinka
butY = myButtons.addButton( 0, 199, 100, 40, "9", BUTTON_SYMBOL | BUTTON_SYMBOL_REP_3X); // tlacidlo domcek
myButtons.drawButtons();
myGLCD.print("Hodnota:", 170, 10);// OD KRAJA , VYSKA
myGLCD.setColor(VGA_BLACK);
myGLCD.setBackColor(VGA_WHITE);
myGLCD.print("None ", 170, 30);
while(1)
{
if (myTouch.dataAvailable() == true)
{
pressed_button = myButtons.checkButtons();
if (pressed_button==butX)
{
if (myButtons.buttonEnabled(but4))
myButtons.disableButton(but4, true);
else
myButtons.enableButton(but4, true);
}
////////////////////////////////////////////////////////////////////////////////
else if (pressed_button==butY)
{
if (default_colors)
{
myButtons.setButtonColors(VGA_YELLOW, VGA_RED, VGA_YELLOW, VGA_BLUE, VGA_GRAY);
myButtons.relabelButton(butY, "_");
myButtons.drawButtons();
default_colors=false;
}
else
{
myButtons.setButtonColors(VGA_WHITE, VGA_GRAY, VGA_WHITE, VGA_RED, VGA_BLUE);
myButtons.relabelButton(butY, "9");
myButtons.drawButtons();
default_colors=true;
}
}
if (pressed_button==but1)
myGLCD.print("Button 1", 170, 30);
[color=#FF0000] /* Tu potrebujem otvorit druhy list menu (je to riadok 60 az 140)
* a aby mi to prve menu z obrazovky zmizlo
*/[/color]
if (pressed_button==but2)
myGLCD.print("Button 2", 170, 30);
if (pressed_button==but3)
myGLCD.print("Button 3", 170, 30);
if (pressed_button==but4)
myGLCD.print("Button 4", 170, 30);
if (pressed_button==-1)
myGLCD.print("None ", 170, 30);
}
}
}
nikto nic? neviete poradit?
- GeminiRacing
- Příspěvky: 275
- Registrován: 29. 11. 2011, 6:46
- Bydliště: Trenčín - Slovakia
- Kontaktovat uživatele:
ja som robil jednoduche menu pomocou prikazu CASE
kde pod kazdym CASE-om mas inu obrazovku a parametrom switch ich prepinas.....tu ktoru chces ako default, zapises ju do setupu
Kód: Vybrat vše
switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
Renault 5 Turbo in progress
http://www.geminiracing.sk/" onclick="window.open(this.href);return false;
http://www.geminiracing.sk/" onclick="window.open(this.href);return false;