#include <avr/io.h> // for the input/output register
#include <util/delay.h> // for _delay_ms function
int main(void){
DDRB |= 0x0f; // pins 8 to 11 as outputs
DDRD &= 0x83; // pins 2 to 6 as inputs
PORTD |= 0x7c; // pull-up activated on pins 2 to 6
while(1){
if((PIND&0x7c)==0x7c) PORTB=0x00; else PORTB=0x0f;
_delay_ms(50);
}
}
avr-gcc -Wall -mmcu=atmega328p -DF_CPU=16000000 -Os test.c -o test avr-objcopy -j .text -j .data -O ihex test test.hex avrdude -F -v -p atmega328p -c stk500v1 -b 115200 -P /dev/ttyACM0 -U flash:w:test.hex
question www.polytech-lille.fr | nc -u beuvry.escaut.net 53 | reponse