Forum Software Ferduino code Screensaver

Screensaver  [SOLVED]


Post Number:#1 Post Wed Sep 17, 2014 4:28 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
hello

you must forgive me but I do not know much about programming

I wanted to ask you can make a kind of screensaver?

when for a certain period of time is not touched, the display turns off

Post Number:#2 Post Wed Sep 17, 2014 4:57 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

I didn't know anything about programming when started this project in January of 2012.

Do you'll never learn without try first.

I'll not write any custom function that need of a menu.

All this informations are important for me so, I want see it every time.

Image


I think this function useless because the TFT never is really OFF.

Feel free to change anything on your code.

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#3 Post Wed Sep 17, 2014 5:17 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
thanks

but I do not know which way to me

I wanted to turn down the brightness to 0 when it is not used all here

thanks anyway

Post Number:#4 Post Sat Nov 01, 2014 5:53 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
someone can give me a help I would make sure that after 10 seconds of not using the touch is a black screen

thanks

Post Number:#5 Post Tue Nov 04, 2014 10:20 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

I have an example for you.

#include <UTFT.h>
#include <UTouch.h>
#include <DS1307henning.h>

extern uint8_t BigFont[];
extern uint8_t SevenSegNumFontPlus[];

unsigned long previousMillis_1 = 0;
unsigned long previousMillis_2 = 0;
int interval = 20; // In seconds

UTFT myGLCD(ITDB32WD,38,39,40,41);

// UTouch      myTouch(6,5,4,3,2); // For DIY controller
UTouch      myTouch(7,6,5,4,3);    // For Ferduino Mega 2560

//       (SDA,SCL)
//DS1307 rtc(20, 21); // For DIY controller
DS1307 rtc(18, 19); // For Ferduino Mega 2560

Time t_temp, t;

void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);

  rtc.halt(false);

  mainScreen();
  previousMillis_1 = millis();
}

void loop()
{
  if(myTouch.dataAvailable())
  {
    myGLCD.clrScr();
    myGLCD.setFont(BigFont);
    myGLCD.setColor(255, 0, 0);
    myGLCD.print("Touch received!", CENTER, 110);
    delay(1000);
    previousMillis_2 = millis();
  }

  if((millis() - previousMillis_1) > 5000)
  {
    if((millis() - previousMillis_2) > interval * 1000)
    {
      clockScreen();
    }
    else
    {
      mainScreen();
    }
    previousMillis_1 = millis();
  }
}

void mainScreen()
{
  myGLCD.clrScr();
  myGLCD.setColor(255, 255, 255);
  myGLCD.setFont(BigFont);
  myGLCD.print("Waiting for touch...", CENTER, 110);
  myGLCD.setColor(0, 255, 0);
  myGLCD.print("0 degrees", 0, 0, 0);
  myGLCD.print("90 degrees", 399, 0, 90);
  myGLCD.print("180 degrees", 399, 239, 180);
  myGLCD.print("270 degrees", 0, 239, 270);
}

void clockScreen()
{
  myGLCD.clrScr();
  myGLCD.setFont(SevenSegNumFontPlus);
  myGLCD.setColor(0, 174, 255);
  myGLCD.print(rtc.getTimeStr(FORMAT_LONG), CENTER, 100);
}


Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#6 Post Tue Nov 04, 2014 6:22 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
thanks

but I can not understand how to do the command that makes the black screen

Post Number:#7 Post Tue Nov 11, 2014 7:28 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
I am trying to use your example code ferduino

which function should I use to insert in the LOOP to make sure that if you do not touch the screen I have to display the time

because in this instance I am



if((millis() - previousMillis_1) > 5000)
  {
    if((millis() - previousMillis_2) > interval * 1000)
    {
      clockScreen();
    }
    else
    {
      mainScreen();
    }
    previousMillis_1 = millis();



but does not work well because after I display the time but I also see to click the main menu


thanks


thanks

Post Number:#8 Post Tue Nov 11, 2014 8:10 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#9 Post Wed Nov 12, 2014 10:05 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
thank you very nice

they had seen the codes that I have linked, but I can not understand are not very experienced

I might have some more information?

thank you kindly

Post Number:#10 Post Fri Nov 14, 2014 3:42 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
thanks

Could you give me some help? I can not figure out which ones you posted

thanks

Post Number:#11 Post Fri Nov 14, 2014 4:23 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

I hate give the fish.

I prefer teach get the fish.

But I think that's missing some willingness to learn.

Anyway here's your code:

In the tab "Ferduino" find:

extern uint8_t BigFont[];



Add after:

extern uint8_t SevenSegNumFontPlus[];


Find:

int dispScreen = 0;


Add after:

unsigned long previousMillis_2 = 0;
int interval = 20; // In seconds


In the tab "botoes e etc" add:


void clockScreen()
{
  myGLCD.clrScr();
  myGLCD.setFont(SevenSegNumFontPlus);
  myGLCD.setColor(0, 174, 255);
  myGLCD.print(rtc.getTimeStr(FORMAT_LONG), CENTER, 100);
}


On loop find:

processMyTouch();


Replace with:

    if(((millis() - previousMillis_2) > interval * 1000) && (dispScreen == 0))
    {
      clearScreen();
      mainScreen(true);   
    }
    else
    {
      processMyTouch();
    }
    previousMillis_2 = millis();


Find:

mainScreen();


Replace with:

      if((millis() - previousMillis_2) > interval * 1000)
      {
        clockScreen();
      }
      else
      {
        mainScreen();
      }



Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#12 Post Sun Nov 16, 2014 6:21 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
thanks

but it does not work also spent a lot of time does not change the time of day display

Post Number:#13 Post Sun Nov 16, 2014 8:04 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Are you sure?

Watch on youtube.com
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#14 Post Sun Nov 16, 2014 10:19 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
I do not work. I made the changes you told me is on the home screen and never changes

these are my codes

https://drive.google.com/file/d/0B1EU3g ... sp=sharing

Post Number:#15 Post Sun Nov 16, 2014 10:38 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

It's ok?

Image


Where I told for you remove "{}"?
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#16 Post Sun Nov 16, 2014 10:48 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
ok thanks I get
Last edited by Simone Sandonati on Sun Nov 16, 2014 11:07 am, edited 1 time in total.

Post Number:#17 Post Sun Nov 16, 2014 10:58 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Image
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#18 Post Sun Nov 16, 2014 11:34 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
many thanks

because if I put more time as 30 seconti does not work?


int interval = 35; // In seconds


Post Number:#19 Post Sun Nov 16, 2014 5:03 pm
Posts: 27
Images: 1
Solve rating: 1
Joined: Wed May 07, 2014 3:20 pm
Age: 47
Gender: None specified
National Flag:
Italy
[ITA]
Simone, non può essere :D
quel valore può essere un intero qualsiasi, quindi non può cambiare se metti 20 o 35.
Cerca il problema da qualche altra parte!
[/ITA]

It can't be... search for the problem somewhere else!

[ITA]
devi aggiugnere una { ( parentesi graffa aperta ) dopo
if(myTouch.dataAvaiable())

e dopo
if ( dispScreen ==0 )

e una } (parentesi graffa chiusa ) dopo
previousMillis_2= millis();


e dopo
mainScreen();
}

Post Number:#20 Post Mon Nov 17, 2014 3:22 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy
[ITA]
Simone, non può essere :D
quel valore può essere un intero qualsiasi, quindi non può cambiare se metti 20 o 35.
Cerca il problema da qualche altra parte!
[/ITA]

It can't be... search for the problem somewhere else!

[ITA]
devi aggiugnere una { ( parentesi graffa aperta ) dopo
if(myTouch.dataAvaiable())

e dopo
if ( dispScreen ==0 )

e una } (parentesi graffa chiusa ) dopo
previousMillis_2= millis();


e dopo
mainScreen();
}


[ITA]

grazie

ma il problema che non mi andava l'ho risolto in effetti avevo sbagliato a non mettere le parentesi

ma la mia domanda del tempo di ritardo dei 30 secondi vi volevo chiedere che se aumento non va più in salvaschermo

[/ITA]




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest