November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!

Revision of Emotion Displayer -- Done by Digital I/O w/ Arduino Board from Thu, 09/13/2007 - 01:26

Project Members: 
Sheng-Ying Pao


Emotion Displayer -- Done by Digital I/O with Arduino Board

I made a "heart" as the diffuser for RGB LEDs.

Red heart represents you are happy.

Blue heart is for depressed feeling.

Green heart shows sth. makes you excited.

When you feel nervous, the heart will blink rapidly in different colors.

The stronger your feeling is, the lighter the LED will be.


I took a short video for the heart, but I found difficulty while uploading it to the course website, so, please click here for the video:

(When uploading video here---

The selected file Sheng-Ying HW2.AVI can not be attached to this post,
because it is only possible to attach files with the following extensions:
jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp.


My Code:

/* Aithne Sheng-Ying Pao
* Serial RGB LED
* ---------------
* I design the interface to express emotion!!! Ex. extremely happy, very depressed, somewhat excited, extremely nervous, and etc.
* Serial commands control the brightness of R,G,B LEDs
* Sep 11 2007

//for a useful string comparison function, see the bottom of this file... stringsEqual()
#include <stdio.h>
#include <string.h>

char serInString[100]; // array that will hold the different bytes of the string. 100=100characters;
// -> you must state how long the array will be else it won't work properly
char colorCode;
char code1; // to record the first char of input string
int colorVal;

int redPin = 9; // Red LED, connected to digital pin 9
int greenPin = 10; // Green LED, connected to digital pin 10
int bluePin = 11; // Blue LED, connected to digital pin 11

int redValue = 000;
int greenValue = 000;
int blueValue = 000;

void setup() {
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
analogWrite(redPin, redValue); // turn off the light as initial state
analogWrite(greenPin, greenValue); //turn off the light as initial state
analogWrite(bluePin, blueValue); // turn off the light as initial state
Serial.println("enter your mood, please choose one from (extremely, very, and somewhat) and choose your mood from (happy, excited, depressed, and nervous) (eg. 'very happy') :");

void loop () {
//read the serial port and create a string out of what you read

readSerialString(serInString, 100);


//Erase anything left in the serial string, preparing it for the
//next loop
resetSerialString(serInString, 100);

delay(100); // wait a bit, for serial data

void resetSerialString (char *strArray, int length) {
for (int i = 0; i < length; i++) {
strArray[i] = '\0';

//read a string from the serial and store it in an array
//you must supply the array variable
void readSerialString (char *strArray, int maxLength) {
int i = 0;

if(!Serial.available()) {
while (Serial.available() && i < maxLength) {
strArray[i] =;

Sheng-Ying HW2 Green Heart.JPG22.04 KB
My Blue Heart.JPG30.39 KB

Powered by Drupal - Design by Artinet