Dies ist eine alte Version des Dokuments!
Wer macht mit
Themen
Vorbereitung
Das hier kann während des wörkshops mit Spickzetteln, Code sippets, Links, … gefüllt werden.
„Löten ist einfach! und so wirds gemacht“ (Comic): fullsoldercomic_de.pdf
Infos: http://ladyada.net/make/boarduino/
Plan als .png: http://ladyada.net/images/boarduino/boarduinosch.png
Chipinfos:
unter: http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf
apt get install
Das müssten alle Pakete sein, die Fisch braucht.
#include <avr/io.h> // this contains all the IO port definitions #include <avr/interrupt.h> // definitions for interrupts #include <avr/sleep.h> // definitions for power-down modes #include <stdio.h> #include <stdbool.h> #include <util/delay.h>
int main() { // 1111 1111 DDRA = 255; DDRA = 0b11111111; DDRA = 0xFF; // alles output DDRA = _BV(PA0) | _BV(PA1) | _BV(PA2) | _BV(PA3) | _BV(PA4) | _BV(PA5) | _BV(PA6) | _BV(PA7); // Data direction register (1 = output / 0 = input)
DDRH = 0b00000000; // alles input PORTH = 0b00000100; // Pull-up an while(true) { // 0000 0000 /* PORTA = 0b00000001; // Erstes led an // Pegel definieren (1 = high / 0 low) //PORTA = _BV(PA6) | _BV(PA4); // Pegel definieren (1 = high / 0 low) _delay_ms(1000); PORTA = PORTA | 0b00000010; // zweites led an _delay_ms(1000); PORTA = PORTA & ~0b00000001; // erstes LED aus _delay_ms(1000); PORTA = PORTA & 0b11111101; // zweites LED aus _delay_ms(1000); */ if(PINH & 0b00000100){ PORTA = PORTA & ~0b00000001; }else{ PORTA = PORTA | 0b00000001; } } // 0000 0001 = 1 = 1 << 0 = _BV(0) = _BV(PA0) // 0000 0100 = 4 = 1 << 2 = _BV(2) = _BV(PA2) // ========================================== // 0000 0101 = 1 | 4 = 5 // BINÄÄÄRES ORDER // 0001 0101 = 21 // 1000 0110 = 134 // =============== // 1001 0111 = 155 // }