/*
 * Ferris Wheel.c
 *
 * Created: 5/2/2022 11:17:18 PM
 * Author : mkkel
 */ 

#define F_CPU 16000000UL		//defines clock for time delays

//include files
#include <avr/io.h>
#include <util/delay.h>		//allows time delay function

int main(void)
{
	
    io_init();		//initialize ports
	
	CW();		//call motor function
	
    while (1) 
    {
		
    }
}

void io_init(void)
{
	DDRA = 0xFF;		//set PORTA as output
	PORTA = 0x00;		//turn all output off
}
void CW(void)
{
	uint8_t FullCW[4] = {0x03, 0x06, 0x0C, 0x09};		//steps of Wave mode
	
	while((PINA & 0x02) == 0)		//while PINA1 equals 0
	{
		for (uint16_t j = 0; j < 4; j++)
		{
			PORTA = FullCW[j];		//use array to rotate clockwise (as you look at motor shaft)
			_delay_ms(4);		//4ms delay
		}
	}
}
