Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
So I found something weird. I have the CapTouchPaint sketch loaded to my BANNED to test it with that shield but for some reason it only runs (draws to the display) when I upload a sketch again. Something that happens during the upload forces it to write the display, something that I can't get it to do otherwise. Any ideas?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Try opening the Serial Monitor. The sketch will wait for that to be opened.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
So I cant run that sketch without the serial monitor? It worked on my Uno before I made the changes.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
The Yun is a Leonardo. Take out the wait for Serial at the beginning of setup()
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
I know it is a Leonardo that is why I soldered the jumpers but I had no idea the Leonardo would get so tripped up on the serial library. I commented all of the serial stuff and it works now.
Rick do you know if anyone could work on making FT6206 versions of all of the ILI9341 examples? Meaning most of the Resistive Touch examples don't work with the Capacitive ones right?
Rick do you know if anyone could work on making FT6206 versions of all of the ILI9341 examples? Meaning most of the Resistive Touch examples don't work with the Capacitive ones right?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
I've got one of these screens on order. I'll see what I can do when it shows up.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Thanks Rick!!
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
This isn't working. I've tried it on the leonardo now too and the same thing happens even though Ive taken out the serial commands. Take a look at my code and let me know what I am doing wrong:
And the error:
Why does it think my Serial port is in use?
Code: Select all
/***************************************************
This is our touchscreen painting example for the Adafruit ILI9341
captouch shield
----> http://www.adafruit.com/products/1947
Check out the links above for our tutorials and wiring diagrams
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h> // this is needed for display
#include <Adafruit_ILI9341.h>
#include <Wire.h> // this is needed for FT6206
#include <Adafruit_FT6206.h>
// The FT6206 uses hardware I2C (SCL/SDA)
Adafruit_FT6206 ctp = Adafruit_FT6206();
// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define BANNED 3
int oldcolor, currentcolor;
void setup(void) {
tft.begin();
if (! ctp.begin(40)) { // pass in 'sensitivity' coefficient
while (1);
}
tft.fillScreen(ILI9341_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
currentcolor = ILI9341_RED;
}
void loop() {
// Wait for a touch
if (! ctp.touched()) {
return;
}
// Retrieve a point
TS_Point p = ctp.getPoint();
/*
// Print out raw data from screen touch controller
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print(" -> ");
*/
// flip it around to match the screen.
p.x = map(p.x, 0, 240, 240, 0);
p.y = map(p.y, 0, 320, 320, 0);
if (p.y < BOXSIZE) {
oldcolor = currentcolor;
if (p.x < BOXSIZE) {
currentcolor = ILI9341_RED;
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*2) {
currentcolor = ILI9341_YELLOW;
tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*3) {
currentcolor = ILI9341_GREEN;
tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*4) {
currentcolor = ILI9341_CYAN;
tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*5) {
currentcolor = ILI9341_BLUE;
tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x <= BOXSIZE*6) {
currentcolor = ILI9341_MAGENTA;
tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
}
if (oldcolor != currentcolor) {
if (oldcolor == ILI9341_RED)
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
if (oldcolor == ILI9341_YELLOW)
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
if (oldcolor == ILI9341_GREEN)
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
if (oldcolor == ILI9341_CYAN)
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
if (oldcolor == ILI9341_BLUE)
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
if (oldcolor == ILI9341_MAGENTA)
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
}
}
if (((p.y-BANNED) > BOXSIZE) && ((p.y+BANNED) < tft.height())) {
tft.fillCircle(p.x, p.y, BANNED, currentcolor);
}
}
Code: Select all
Binary sketch size: 14,608 bytes (of a 28,672 byte maximum)
processing.app.SerialException: Serial port '/dev/tty.usbmodemfd121' already in use. Try quitting any programs that may be using it.
at processing.app.Serial.touchPort(Serial.java:119)
at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:203)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
at processing.app.Sketch.upload(Sketch.java:1671)
at processing.app.Sketch.exportApplet(Sketch.java:1627)
at processing.app.Sketch.exportApplet(Sketch.java:1599)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:695)
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
That's just a Yun/Leonardo gremlin. Whenever I get that, I try unplugging from USB, try hitting the reset button just before it uploads, that sort of thing. It usually goes away.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Sure enough. It seems when I press the reset button right after I apply power it works. But that really isn't going to work. I need this entire thing to be enclosed and I only plan to have the display exposed.
Is there some kind of programming work around? Please help! I can't be pressing reset every time.
Is there some kind of programming work around? Please help! I can't be pressing reset every time.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Do you have to do it every time? Have you tried rebooting your computer? This is a USB issue.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
It still wont work so I'm giving up. I wrote my own code to use Temboo Choreos and display them on the TFT that isn't having that issue so I will just stick with that for now and let you know if I have any trouble.
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Question about the TFT.
I am writing weather data from the Yahoo Weather APT using Temboo. I want it to clear the display and re-write each time or allow me to scroll. Any ideas?
Here is my code:
I am writing weather data from the Yahoo Weather APT using Temboo. I want it to clear the display and re-write each time or allow me to scroll. Any ideas?
Here is my code:
Code: Select all
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information, as described below
//display libraries
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h> // this is needed for display
#include <Adafruit_ILI9341.h>
#include <Wire.h> // this is needed for FT6206
#include <Adafruit_FT6206.h>
Adafruit_FT6206 ctp = Adafruit_FT6206();
// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int numRuns = 1; // Execution count, so this doesn't run forever
int maxRuns = 10; // Maximum number of times the Choreo should be executed
void setup() {
Bridge.begin();
tft.begin();
tft.fillScreen(ILI9341_BLACK);
}
void loop() {
if (numRuns <= maxRuns) {
tft.println("Running GetWeatherByAddress - Run #" + String(numRuns++));
TembooChoreo GetWeatherByAddressChoreo;
// Invoke the Temboo client
GetWeatherByAddressChoreo.begin();
// Set Temboo account credentials
GetWeatherByAddressChoreo.setAccountName(TEMBOO_ACCOUNT);
GetWeatherByAddressChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
GetWeatherByAddressChoreo.setAppKey(TEMBOO_APP_KEY);
// Set Choreo inputs
GetWeatherByAddressChoreo.addInput("Address", "318 N 400 E, Provo Utah 84606");
// add an output filter to extract the current temperature
GetWeatherByAddressChoreo.addOutputFilter("temperature", "/rss/channel/item/yweather:condition/@temp", "Response");
// add an output filter to extract the date and time of the last report.
GetWeatherByAddressChoreo.addOutputFilter("date", "/rss/channel/item/yweather:condition/@date", "Response");
// Identify the Choreo to run
GetWeatherByAddressChoreo.setChoreo("/Library/Yahoo/Weather/GetWeatherByAddress");
// Run the Choreo; when results are available, print them to serial
GetWeatherByAddressChoreo.run();
while(GetWeatherByAddressChoreo.available()) {
char c = GetWeatherByAddressChoreo.read();
tft.print(c);
}
GetWeatherByAddressChoreo.close();
}
tft.println("Waiting...");
delay(30000); // wait 30 seconds between GetWeatherByAddress calls
}
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
Move this
from setup() to the top of loop()
Code: Select all
tft.fillScreen(ILI9341_BLACK);
Code: Select all
void loop() {
tft.fillScreen(ILI9341_BLACK);
if (numRuns <= maxRuns) {
... etc ...
- DisruptItYourself
- Posts: 193
- Joined: Mon Sep 23, 2013 6:58 pm
Re: Cap Touch TFT Shield and Arduino Yun - PLEASE HELP
That's cool and all but it makes each write progressively lower on the screen. Any other ideas?
Please be positive and constructive with your questions and comments.