The push button S1 shall behave as a toggle switch to turn the led LED1 on and off.
Scenario: Initial state
Given the device is powered on
Then the LED is turned offScenario: Turn LED on
Given the device is powered on
When I press the button
Then the LED is turned onScenario: Turn LED off
Given the device is powered on
When I press the button
And I press the button again
Then the LED is turned offThe qmake project provides the following make targets.
Run the unit tests:
make check
Run the feature tests:
make run-bdd
Download the firmware to the AVR
make flash
#ifdef __AVR
// avr-gcc defines preprocessor variable __AVR
#endif
// pin and port definitions
#include <avr/io.h>
// set pin PB0 as output, PB7-PB1 as input
DDRB = _BV(PB0);
// set pin PB0 as input, PB7-PB1 as output
DDRB = ~(_BV(PB0));
// clear PB0
PORTB &= ~(_BV(PB0));
// set PB0
PORTB |= _BV(PB0);
// toggle PB0
PORTB ^= _BV(PB0);
// read port
unsigned port = PINB
// check pin PB0
bool state = PINB & _BV(PB0)
