COLL 142 - Week 02

Fun with (and not breaking) LEDs

Salvatore "Sal" Testa /@saltesta14

with special guest Christian Henry

What is an LED?

Light Emitting Diode

Light Emitting Diode

How do I keep from blowing-up everything?

Be aware of Ohm's Law

Voltage = Current × Resistance

How to calculate current with LED

Demo Time!

If you're unsure, ask for help.

What does this have to do with MSP430s?

Code structure


void setup()
{
  // put your setup code here, to run once:
}

void loop()
{
  // put your main code here, to run repeatedly:
}
					

Basic Example


int YELLOW_LED = P1_1;

void setup()
{
  // put your setup code here, to run once:
  pinMode(YELLOW_LED, OUTPUT);   
  digitalWrite(YELLOW_LED, HIGH);
}

void loop()
{
}
					

How can we bring this all together?

Make an LED-cardboard sign.

  • cardboard
  • at least 8 LEDs
  • 3 animations patterns that repeat