Thursday 29 May 2014

HTML to LCD via arduino

This might be a workaround to get text onto an LCD or LED dotmatrix for the code-shy among us...
http://everettsprojects.com/2011/05/19/arduino-project-html-to-lcd/

Twitter RSS Feeds

As you might have found out, Twitter changed their API code meaning that many Arduino Sketches that call twitter timelines no longer work.
This may be of use, as it converts twitter timelines to rss...
https://www.youtube.com/watch?v=BXLYIw-IU8I#t=70
Could also be useful and seems quite simple..
http://twss.55uk.net/



Saturday 24 May 2014

Twitter Client to post CSC Sports news on a DOT MATRIX LED screen

The twitter API code changed at some stage - 2013? Most twitter arduino sketches do not work for this reason.
ArduinoForProjects has this page...
http://duino4projects.com/displaying-twitter-feed-without-a-pc-using-arduino/
With this code for download. As it might be a problem to download the code at school, here is the sketch...

/*
 * Twitter2LCD
 * gets xml data from http://twitter.com/statuses/user_timeline/16297873.rss
 * reads the most recent tweet from field:  <title>
 * writes the output to the LCD.

 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 See more here:
 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */


#include <Ethernet.h>
#include <EthernetDHCP.h>
#include <TextFinder.h>
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte server[] = {128,242,240,20}; // Twitter

char tweet[140];

Client client(server, 80);

TextFinder  finder( client );

void setup()
{
  lcd.begin(20,4);
  lcd.clear();
  lcd.print("Twitter2LCD");
  Serial.begin(9600);
  EthernetDHCP.begin(mac);
}


void loop()
{
  lcd.clear();
  if (client.connect()) {
    client.println("GET http://www.twitter.com/statuses/user_timeline/16297873.rss HTTP/1.0");  // twitter rss for fgranelli
    client.println();
  }
  else {
    lcd.println("Connection failed");
    Serial.println("Connection failed");
  }
  if (client.connected()) {
     // get the last tweet by simply parsing the item and title tags
     if((finder.find("<item>")&&(finder.getString("<title>","</title>",tweet,140)!=0)))
     {
         Serial.println(tweet);
       
         for (int j=0; j<2; j++) {
           // first part of the tweet
           lcd.clear();
           lcd.setCursor(0,0);
           for (int i=0; i<20; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,1);
           for (int i=20; i<40; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,2);
           for (int i=40; i<60; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,3);
           for (int i=60; i<80; i++)
             lcd.print(tweet[i]);
           delay(10000);
           // second part of the tweet
           lcd.clear();
           lcd.setCursor(0,0);
           for (int i=60; i<80; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,1);
           for (int i=80; i<100; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,2);
           for (int i=100; i<120; i++)
             lcd.print(tweet[i]);
           lcd.setCursor(0,3);
           for (int i=120; i<140; i++)
             lcd.print(tweet[i]);
           delay(10000);
           }
     }
    else
      lcd.println("Could not find item field");
  }
  else {
    lcd.println("Disconnected");
  }
  client.stop();
  client.flush();
  delay(60000); // wait a minute before next update
}

Tuesday 20 May 2014

Serial Print

The next steps for our "Sports Results Display" will be getting the LED screen to print SERIAL.

Having done this, we think that the following steps will be needed:
  1. Get LED screen to print through serial.
  2. Find information about setting up through ethernet and Twitter.
  3. Find out how Twitter accounts work.
  4. Set up a twitter account and experiment.
Having had big problems connecting, we have decided not to use Mr Jagoutz's laptop. We spent the whole lesson trying to connect the Uno but no luck...

Next step is to load Arduino IDE onto computers in T4.