Tuesday 3 June 2014

Writing A Class

Writing A Class In Processing

As I'm not a programmer my understanding of the lingo needs improving I decided to investigate it. This tutorial by Daniel Shiffman (lots of good stuff on his website) helped me understand how they work.

Get to the chopper!

So me and a friend Micheal were drinking a few in my room and he suggested we make an app that when the button is pressed a random jpeg is displayed along with an mp3- we didn't get that far, but the next day i looked over it and decided to make it work but i would use classes.

Say cheese!

The Arnold app

All the libraries i used should be included with processing. A problem i couldn't work out is that i wanted to be able to be a bit "trigger happy" with the mouse button, So that if the user didn't like the mp3 being played they could simply click and a new picture and mp3 would be played. I couldn't figure it out and we think its something to do with having one audio player object, having more would overkill for a small app. The solution would be to find a new library with better features and use something "better" like Python.

Multiple Serial Ports

Exploring Multiple Serial Ports Using Arduino Mega.


I searched around for this because i will need to use it in future projects, at the moment i'm gearing up to build a mobile platform- wouldn't it be nice if it could map a room using sonar data... Anyway i found this excellent blog that explains it nearly perfectly apart from the TX to RX bit in step one, just beware, if you don't know what i'm on about I've made a comment at the bottom of his post.

Using a USB to serial TTL cable allows another serial port to be connected to a PC from the mega. 

USB To TTL Cable 

The mega has 4 possible ports to utilize. The green is TX and should be connected to RX on the board the white is RX and should be connected to TX on the board, red is power and is optional (5V external) and black is ground. the USB is simply connected to a port on the PC.

Ive put together a sketch that reads an LDR and prints the value to one serial port whilst the other port is used to keep track of when an led (the on board one connected to pin 13) is turned on and off using a button.

Resistors 10K (theres one behind the LDR)

To view two serial monitors in the arduino IDE open a fresh arduino program and set that to the serial port of your cable, or use Tera Term.

Com7 Showing LDR Values Com9 showing that switch is off