Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
#include <iom169.h> /* replace with the correct header file */
#include <intrinsics.h>
#include <avr_macros.h>
#include <stdio.h>
// bits
#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80
// port D stuff
#define LED BIT6
#define BUTTON BIT7
// inputs
#define SWITCH_ON (PIND & BUTTON) == 0
#define SWITCH_OFF (PIND & BUTTON) != 0
// outputs
#define LED_ON PORTD |= LED
#define LED_OFF PORTD &= ~LED
int
main(void)
{
DDRD=BIT6; // Set pin 6 as output, all others as inputs
while(1)
{
if (SWITCH_ON)
LED_ON;
else
LED_OFF;
}
return(0); // this line will never execute
}