O ITBD02-1.8SP é um módulo LCD TFT de 1.8" com 65K cores e resolução 128 x 160. A interface do display é serial, por isso só precisa de 5 fios (CS, RS, SCL, SDA, RST) para o controlo. O controlador deste Módulo LCD é o ST7735.
O ITDB02-1.8SP é suportado pela livraria UTFT.
Especificações:
• Resolução: 128 x 160;
• Interface: serial;
• Tipo do ecrã: não tátil;
• Controlador: ST7735;
• Tamanho: 1.8";
• Dimensões da placa: 50 x 37mm;
• Peso: 30g.
Possível Esquema de Ligação:
Código Exemplo:
/* ===============================================================================
Project: Weather Reporter: Temboo, Ethernet, Arduino
Title: ARDUINO MASTER: Get temperature from Yahoo using Temboo
Arduino IDE: 1.6.0
Description: The following sketch was designed for the Arduino MASTER device.
It will retrieve temperature/weather information from Yahoo using your
Temboo account (https://www.temboo.com/), which will then be sent to the
Arduino Slave device to be displayed on a TFT LCD module.
Libraries : Ethernet Library (that comes with Arduino IDE)
Temboo Arduino Library - https://www.temboo.com/sdk/arduino
Temboo Library installation instructions for Arduino:
https://www.temboo.com/arduino/others/library-installation
You will also need to copy your Temboo Account information into a new tab and call it TembooAccount.h.
---------------------------------------------------------------------------------- */
#include <SPI.h>
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account information - in a new tab.
#include <Wire.h>
byte ethernetMACAddress[] = ETHERNET_SHIELD_MAC; //ETHERNET_SHIELD_MAC variable located in TembooAccount.h
EthernetClient client;
String Address = "Perth, Western Australia"; // Find temperature for Perth, Western Australia
String Units = "c"; // Display the temperature in degrees Celcius
String ForeCastDay[7]; //String Array to hold the day of the week
String ForeCastTemp[7]; //String Array to hold the temperature for that day of week.
int counter1=0; //Counters used in FOR-LOOPS.
int counter2=0;
boolean downloadTemp = true; // A boolean variable which controls when to query Yahoo for Temperature information.
void setup() {
Wire.begin(); // join i2c bus : Used to communicate to the Arduino SLAVE device.
// Ethernet shield must initialise properly to continue with sketch.
if (Ethernet.begin(ethernetMACAddress) == 0) {
while(true);
}
//Provide some time to get both Arduino's ready for Temperature Query.
delay(2000);
}
void loop() {
if (downloadTemp) {
downloadTemp=false; //Stop Arduino from Querying Temboo repeatedly
getTemperature(); //Retrieve Temperature data from Yahoo
transmitResults(); //Transmit the temperature results to the Slave Arduino
}
}
/* This function will Query Yahoo for Temperature information (using a Temboo account) */
void getTemperature(){
TembooChoreo GetWeatherByAddressChoreo(client);
// Invoke the Temboo client
GetWeatherByAddressChoreo.begin();
// Set Temboo account credentials
GetWeatherByAddressChoreo.setAccountName(TEMBOO_ACCOUNT); //TEMBOO_ACCOUNT variable can be found in TembooAccount.h file or tab
GetWeatherByAddressChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); //TEMBOO_APP_KEY_NAME variable can be found in TembooAccount.h file or tab
GetWeatherByAddressChoreo.setAppKey(TEMBOO_APP_KEY); //TEMBOO_APP_KEY variable can be found in TembooAccount.h file or tab
// Set Choreo inputs
GetWeatherByAddressChoreo.addInput("Units", Units); // Set the Units to Celcius
GetWeatherByAddressChoreo.addInput("Address", Address); // Set the Weather Location to Perth, Western Australia
// Identify the Choreo to run
GetWeatherByAddressChoreo.setChoreo("/Library/Yahoo/Weather/GetWeatherByAddress");
// This output filter will extract the expected temperature for today
GetWeatherByAddressChoreo.addOutputFilter("Temperature", "/rss/channel/item/yweather:condition/@temp", "Response");
// These output filters will extract the forecasted temperatures (we need to know the day and temperature for that day)
GetWeatherByAddressChoreo.addOutputFilter("ForeCastDay", "/rss/channel/item/yweather:forecast/@day", "Response");
GetWeatherByAddressChoreo.addOutputFilter("ForeCastHigh", "/rss/channel/item/yweather:forecast/@high", "Response");
// Run the Choreo;
GetWeatherByAddressChoreo.run();
//Reset our counters before proceeding
counter1 = 0;
counter2 = 0;
while(GetWeatherByAddressChoreo.available()) {
// This will get the first part of the output
String name = GetWeatherByAddressChoreo.readStringUntil('x1F');
name.trim(); // get rid of newlines
// This will get the second part of the output
String data = GetWeatherByAddressChoreo.readStringUntil('x1E');
data.trim(); // get rid of newlines
//Fill the String Arrays with the Temperature/Weather data
if (name == "Temperature") {
ForeCastDay[counter1] = "Today";
ForeCastTemp[counter2] = data;
counter1++;
counter2++;
}
if(name=="ForeCastDay"){
ForeCastDay[counter1] = data;
counter1++;
}
if(name=="ForeCastHigh"){
ForeCastTemp[counter2] = data;
counter2++;
}
}
//Close the connection to Temboo website
GetWeatherByAddressChoreo.close();
}
/* This function is used to transmit the temperature data to the Slave Arduino */
void transmitResults(){
char tempData[10];
int tempStringLength = 0;
//Modify the current temp to "Now"
ForeCastDay[0] = "Now";
//Send * to Slave Arduino to prepare for Temperature Transmission
Wire.beginTransmission(4); // Transmit to device #4 (Slave Arduino)
Wire.write("*");
delay(500);
Wire.endTransmission();
delay(500);
//Send the temperatures on the Slave Arduino to be displayed on the TFT module.
for (int j=0; j<20; j++){
for (int i=0; i<6; i++){
memset(tempData,0,sizeof(tempData)); //Clear the character array
String tempString = String(ForeCastDay[i] + "," + ForeCastTemp[i] + ".");
tempStringLength = tempString.length();
tempString.toCharArray(tempData, tempStringLength+1);
Wire.beginTransmission(4); // Transmit to device #4 (Slave Arduino)
Wire.write(tempData);
delay(1000);
Wire.endTransmission();
delay(4000);
}
}
/* ----------------------------------------------------------------------
// You can use this to send temperature results to the Serial Monitor.
// However, you will need a Serial.begin(9600); statement in setup().
Serial.println("The Current Temperature is " + ForeCastTemp[5] + " C");
Serial.println();
Serial.println("The Expected Temperature for");
for (int i=0; i<5; i++){
Serial.println(ForeCastDay[i] + " : " + ForeCastTemp[i] + " C");
}
---------------------------------------------------------- */
}
Documentos:
→ Datasheet