Show Posts
Pages: [1] 2 3 ... 122
1  Using Arduino / Displays / Re: 2.2" TFT Module for Arduino from dx.com on: September 17, 2014, 11:33:17 am
This should get you going with code.

You MUST run both Arduino & display at 3.3Volt or use voltage conversion.


I use the 2.2" unit in many Arduino projects:
http://www.hackster.io/rayburne/blazing-paddles
http://www.hackster.io/rayburne/the-qbf-signal-generator
http://www.hackster.io/rayburne/color-glcd-terminal-26-ch-x-15-ln
http://www.hackster.io/rayburne/5-billion-arduino-gps-clock-for-25
http://www.hackster.io/rayburne/psoc-4-using-the-color-glcd-ili9341 PSoC ARM implementation


If you need more, search this forum for ILI9341


Ray
2  Using Arduino / Displays / Re: 2.4" touch screen display ili9341 on: September 17, 2014, 10:21:04 am
Thank you Mr. Burne.
Actually I have looked at your projects last night after I posted the question while looking for more info.
I am at the moment tied to the Uno or better said atmega 328. I have a few of them for small projects, dip package, easy to replace if I damage them. I'm not yet ready to move up as most of my needs are met by this chip at the moment.
I like the GPS clock thou smiley Good work!

Most of my projects are AVR'ish in nature.  The ARM PSoC was a summer diversion for my own edification as some of my friends and acquaintances are die-hard ARM folk.  The PSoC was an inexpensive way to explore both ARM and also re configurable silicon hardware... a pretty amazing technology.

The ILI9xxx TFT displays are inexpensive enough that you can even build toys: (actually the ILI9163C chip)
http://www.hackster.io/rayburne/fortune-telling-arduino

Everyone seems to get 'hung-up' with the 3.3V requirements and then try and do silly stuff like resistor dividers and level shifters and such... the cheap way to do this is to simply run the AVR at 3.3V too.  There are Chinese sellers lined up on their east cost to sell us 3.3V Arduino mini's that run at 8MHz (similar to the Sparkfun offering.)  I have yet to have an issue with the 16MHz 328 mini boards running at 3.3 Volts... I may one day, but never have yet.  Also, for many of the 328P projects, all you have to do is set the fuses to run at 8MHz and the internal clock... good 'nuff.

As you mentioned the GPS clock, here is a memory breakdown of Flash/SRAM using the ILI9341 TFT and the following libraries:
Code:
#include <SPI.h>
#include "Adafruit_GPS.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"
#include "GLCD.h"
#include "Utilities.h"  // my own lib for DayOfWeek, Month Names, DaysInMonth and other algorithms
#include <SoftwareSerial.h>
#include <Streaming.h> // note this library does not generate any flash usage
Quote
C:\Users\Public\ELFtemp\GPS_GLCD_uBlox_BIG.cpp.elf
AVR Memory Usage
----------------
Device: Atmega-328P

Program:   19572 bytes
(.text + .data + .bootloader)

Data:       1275 bytes
(.data + .bss + .noinit)


So, even with only 2K of SRAM, there is plenty of expansion room for a few additions... temperature via thermistor is already incorporated, but history and barometric pressure would be a fun thing to implement.  Maybe even an alarm.

Ray
3  Using Arduino / Displays / Re: 2.4" touch screen display ili9341 on: September 17, 2014, 07:24:37 am
In general, the TFT ILI93xx series of displays, in my opinion, are inexpensive because they are inexpensive to build.  They are also toward the slower end for graphic use with a 16MHz uC, and finally they take significant uC resources to incorporate them into common projects - and Arduino is the largest of the user-project base.

Still, these are quiet adequate for many things and I use the 2.2" unit in many Arduino projects:
http://www.hackster.io/rayburne/blazing-paddles
http://www.hackster.io/rayburne/the-qbf-signal-generator
http://www.hackster.io/rayburne/color-glcd-terminal-26-ch-x-15-ln
http://www.hackster.io/rayburne/5-billion-arduino-gps-clock-for-25
http://www.hackster.io/rayburne/psoc-4-using-the-color-glcd-ili9341 PSoC ARM implementation

My recommendation is to find a library that works for you that balances SRAM and Flash usage, pick a readable font, and then use that library and settings for all similar projects.  By keeping a common set of support software you will make you life far easier.


Ray

http://www.adafruit.com/datasheets/ILI9341.pdf  PDF manual hosted by Adafruit
4  Using Arduino / Displays / Re: 2.4" touch screen display ili9341 on: September 15, 2014, 04:52:37 pm
or is there a way to convert xpt2046 to normal touch output or to STMPE610 becouse i don't will solder wires to the chip and the pins are to smal for my to do that.
so is there another way?
or can i disconnect the ribbon cable of the touchscreen to an touch connector?
if yes: wich connector will i use for that?

I have never heard of anyone doing this in this forum.  Anything can likely "be done" but finding the right materials could be difficult.  I am afraid you are on your own on this unless someone has actually done something like this.
5  Using Arduino / Displays / Re: 2,2" TFT Display + Arduino Uno on: September 14, 2014, 07:37:28 pm
Run the ILI9340/41 ONLY from 3.3V.

Most Arduino clones like the Mini, Nano, Pro will run @16MHz... No guarantees.  If you must run the Arduino at 5V you MUST use level shifter(s).

An alternative us the 8MHz 3.3V Arduino compatible from Sparkfun (others.)

My ILI9341 projects:
http://www.hackster.io/rayburne
6  Using Arduino / Displays / Re: Problem 2.2" TFT SPI LCD Library adafruit on: September 14, 2014, 07:30:03 pm
1.- Please: Kick your ancient arduino-1.0.5-r2  IDE

2.- Download arduino 1.5.7-Beta IDE

3.- Follow this post:  http://forum.arduino.cc/index.php?topic=265806.0

New SPI-library

4.- Enjoy your 2.2" TFT!!!

The 1.0.5r2 is still the recommended version.
http://arduino.cc/en/Main/Software

I have at least 3 posts on my blog using ILI9340/1...
http://www.hackster.io/rayburne

Electroman:
Put libraries in .../Arduino/Libraries like you are suppose to do.  Delete libraries in your sketch folder.  If you like, download one of my sketches that rely upon Adafruit's libs.

Ray
7  Using Arduino / Displays / Re: 2.4" touch screen display ili9341 on: September 14, 2014, 07:20:06 pm

ok, so if i not connect correct it will be broken?


ok, so if i not connect correct it will MAY be broken...
8  Using Arduino / Microcontrollers / Re: Programm ATMEL Attiny (45/85 and 2313) with an Arduino Yún. How? on: September 14, 2014, 07:05:28 pm
I have used a Sparkfun 32U4 with Nick Gammon's code:

Resources: http://www.gammon.com.au/forum/?id=11637

9  Using Arduino / Microcontrollers / Re: Timer interrupts with ATtiny on: September 14, 2014, 07:01:15 pm
@giuliof:

Maybe delete the WDT and insert your timer/ISR in this working t85 project:
http://www.hackster.io/rayburne/hot-yet

Ray
10  Using Arduino / Microcontrollers / Re: attiny85 analog pins wont work on: September 14, 2014, 06:56:32 pm
i am trying to make a led light up when certain amount of volts go in to the attiny85 analog but i cant get it to work can some give me a example code for the attiny 85 analog pins

Sample code + more... Gut the WDT stuff and tri-color LEDs if you like...
http://www.hackster.io/rayburne/hot-yet

Ray
11  Using Arduino / Microcontrollers / Re: Watchdog Timer with Attiny 85 on: September 14, 2014, 06:48:39 pm
@iA2K...

Take a look at this t85 project.  It wakes and immediately goes back to sleep if the thermistor has not changed value... The value persists thru the sleep.  Same idea with photocel, I should think.

http://www.hackster.io/rayburne/hot-yet

The trick w/ battery power is to sleep much longer than you are awake unless there is work to do.  It is not absolutely necessary to use an interrupt to awake if you go back to sleep quickly.

Ray
12  Using Arduino / Programming Questions / Re: Serial.read() multiple bytes immediately after each other on: September 14, 2014, 05:44:46 pm
Quote
i want to send commands to my arduino mega2560 in patterns like this, using the serial connection:
"DM 100 150 "

Quote
Add 2.5 6.8 (cr)

If you want to build out a command engine, take a look at my calculator code:
http://forum.arduino.cc/index.php?topic=147550.0

Ray
13  Using Arduino / Programming Questions / Re: Serial.read - How to parse serial input without delimiters on: September 14, 2014, 05:31:37 pm
Quote
I really tried to get my head around this with all the examples, but there were too many obstacles for me, that i have to learn first before i can accomplish a task like this. I will check the working code step by step to understand it. Unfortunately i have to get this going soon, so it really helps to have a working code for now.

Please do take the time to work through the examples, use forum search and Google to gain a firm understanding of what the instructions are doing.

You got a "get out of jail" pass today, but the forum was kind to you.  In the future, I expect more effort on your part.

Ray
14  Using Arduino / Programming Questions / Re: Serial.read - How to parse serial input without delimiters on: September 14, 2014, 03:26:39 pm
Ray, "Everyone needs a working example..."
Caveat: There are many, many ways to solve this puzzle.  The code shown is neither intended to be the best example or the most efficient example - it is just an example that I thought could be followed simply.

Ray


The following code will produce this output in the console 9600 BAUD:
Quote
Beginning Example Run...
Original String: ZD2b102c080c090e05ba0549

Substrings: 0x08 : 0x2c


Hours: 8  Minutes: 44
 

Code:
/*
Example by mrburnette (ray) on nano 20140914
Binary sketch size: 5,844 bytes (of a 30,720 byte maximum)
Ray says, "Public domain example"
http://forum.arduino.cc/index.php?topic=266669.msg1881289#msg1881289
How do i get index 6+7 and 8+9 from a stream of 24 chars that come from the serial input into the Arduino?
The connected serial device is in idle mode until i send a command to it. When i send “ZD”,
it will send a timecode in the format ZD2b102c080c090e05ba0549, where ZD stands for the type of message it returns.
2c represents the minutes and 08 the hours of the the current time (in HEX format). The last 4 chars are a checksum.
There is no CR or NL at the end. I would like to get the minutes and hours as interger values.
References: http://forum.arduino.cc/index.php?topic=87797.0

The problem, extract MM and HH (hex format) as integers
 0123456789
"ZD2b102c080c090e05ba0549\0"
       mmhh
*/

#include <Streaming.h>  // get used to this library - it makes serial output fun

char sInput[] = {"ZD2b102c080c090e05ba0549\0"} ;
String sMM ; // 0xHH\0 = 5 characters
String sHH ;
char Mbuf[]= { '\0','\0','\0','\0','\0'} ;
char Hbuf[]= { '\0','\0','\0','\0','\0'} ;
int hours, minutes ;

void setup(void)
{
  Serial.begin(9600);
  delay(1000);
  Serial << "Beginning Example Run...\r\n" ;
  Serial << "Original String: " << sInput << "\r\n\r\n" ;
  // alternate http://arduino.cc/en/Reference/StringSubstring
  // Ref:      http://arduino.cc/en/Reference/StringToCharArray
  // Ref:      http://stackoverflow.com/questions/23576827/arduino-convert-a-sting-hex-ffffff-into-3-int
 
  sMM += "0x" ;
  sMM += sInput[6];
  sMM += sInput[7];
  sMM += '\0' ;
  sHH += "0x" ;
  sHH += sInput[8];
  sHH += sInput[9];
  sHH += '\0' ;
  Serial << "Substrings: " << sHH << ":" << sMM << "\r\n\r\n" ;
  sMM.toCharArray( Mbuf, 5 ) ;
  sHH.toCharArray( Hbuf, 5 ) ;
  hours  = (int)strtol(Hbuf, NULL, 16);//cast to (int) because strtol returns long
  minutes= (int)strtol(Mbuf, NULL, 16);
  Serial << "Hours: " << hours << "  Minutes: " << minutes << "\r \n";
 
  Serial << "\r\n *****End of run*****\r\n" ;
  Serial.end();
}

void loop( void ) {}

15  Using Arduino / Programming Questions / Re: Serial.read - How to parse serial input without delimiters on: September 14, 2014, 11:03:42 am
Code:
 if(Serial1.available())
  {
    char myChar = Serial1.read();
    if (myChar == 'c')
    {
      Hour = Serial.parseInt();
      Serial.println(Hour);
      Minute = Serial.parseInt();
      Serial.println(Minute);
    }
  }

You have only read 1 character from the serial1 port!  You have to read beyond (or to the end) of the line before attempting to parse out the Hour/Minute.
Code:
                   } while ( !( c == '*' ) && k < 120) ;   // marker
In my earlier GPS example (C code for another processor), I read until I find a '*' or until I fill the array completely.  In your case, you can read and stop after receiving 24 characters.


Ray

PS: Just a note... this is a fundamental concept in any C uC program and we are attempting to give you hints... there are many ways this can be coded, so everyone is stating their favorite methodology.  This is life with Arduino on the forum.  We could give you the solution, but that is simply unfair to you.  If you get frustrated; back-off for a while and return.  Once the concept is understood, you will be happy we did not spoon-feed you.

Another Note:
When I mess around with parsing, I usually start with one of two crutches:
- Set a string variable to representative data instead of reading the serial port,
- Set the console in loopback mode so I can type the input string instead of using the device
This allows me to work on the parsing methodology before having to mess with reading from the (real) serial device.

You may wish to look at: https://www.inkling.com/read/arduino-cookbook-michael-margolis-2nd/chapter-4/recipe-4-3

Also, to my knowledge ParseInt() works only on numeric strings, 0-9... which is to say, I do not think it can manipulate HEX.  I may be wrong! Take a look at function; http://docs.roxen.com/pike/7.0/tutorial/strings/sscanf.xml

Late Addition:
If you would like to play around with serial parsing concepts in a working program, you may want to run my sketch here:
http://forum.arduino.cc/index.php?topic=147550.0
At least, it may take the edge off that HEX stuff for a while  smiley-eek-blue
Pages: [1] 2 3 ... 122