Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Canvas_SEEEDTOUCH.h>
- #include <Button.h>
- // Hay dos componentes principales en la librería: El Canvas, y los elementos (Widgets) como los Botones
- /*
- * Canvas
- * Parametros:
- * orientación - TFT_LANDSCAPE o TFT_PORTRAIT
- * color de fondo
- */
- Canvas_SEEEDTOUCH canvas = Canvas_SEEEDTOUCH(TFT_LANDSCAPE,BLACK);
- /*
- * Button
- * Parametros:
- * ancho (w)
- * alto (h)
- * bgColor
- * fgColor
- * borderColor
- */
- Button btnStartReset = Button(100,40,GRAY1,WHITE,GRAY2);
- void setup() {
- Serial.begin(9600);
- canvas.init();
- btnStartReset.setText("START");
- btnStartReset.setEventHandler(&btnStartResetEventHandler);
- btnStartReset.fontSize = 4;
- canvas.add(&btnStartReset,110,190);
- }
- void loop() {
- canvas.scan();
- }
- // Event handler for the button
- void btnStartResetEventHandler(Button* btn){
- if(btn->touched){
- btnStartReset.setText("RESET");
- }else{
- btnStartReset.setText("START");
- }
- btn->show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement