Week 5: Microcontroller Programming
Designing in Eagle:
PCB Milling
The faliure in Architecture shop: some lines are not continuous. The machine was stopped coulpe of times without any reasons.
Then, i went to CBA shop and used David's wonderful machine.
Super fast and neat. I made the soldering there with the help of Jie Qi:
Coding from David's programing workshop and Matt's debugging helping section. thanks a lot for those helps.
codes (bascially from David):
// Our LED-Switch program
#include <avr/io.h>
#define F_CPU 1e6
#include <avr/delay.h>
#define TRUE 1
#define FALSE 0
int main()
{
//SETUP
//Button is on PB2
//LED is PA3
PORTA= _BV(PA3); //Turn button pullup resistor on
DDRB = _BV(PB2); //Enable output on the LED pin
//LOOP
while (TRUE)
{
if (PINA & _BV(PA3)) //button has not been pushed
//if (bit_is_set(PINB, PA3))
{
PORTB = 0; //turn LED off
}
else
{
PORTB = _BV(PB2); //turn LED on
}
}
}
finally, it works: