Removed unused variable from examples, set default main.c to blink example.

This commit is contained in:
Marvin Blum
2018-10-30 21:35:33 +01:00
parent 9cec38e23c
commit 57072f9ad0
4 changed files with 12 additions and 27 deletions

View File

@@ -24,8 +24,6 @@ void prepare(){
pin_mode(A2, INPUT);
}
unsigned char pwm = 0;
void loop(){
int analog1 = analog_read(A1);
int analog2 = analog_read(A2);

View File

@@ -25,8 +25,6 @@ void prepare(){
pin_mode(8, INPUT);
}
unsigned char pwm = 0;
void loop(){
if(digital_read(10) && digital_read(8)){
digital_write(11, HIGH);

13
compile
View File

@@ -1,11 +1,11 @@
#!/bin/bash
#MMCU=atmega328p
MMCU=atmega168
#AVR_TYPE=ATMEGA328P
AVR_TYPE=ATMEGA168
#BAUD=57600 # atmega328p
BAUD=19200 # atmega168
MMCU=atmega328p
#MMCU=atmega168
AVR_TYPE=ATMEGA328P
#AVR_TYPE=ATMEGA168
BAUD=57600 # atmega328p
#BAUD=19200 # atmega168
echo "MMCU set to $MMCU"
echo "AVR_TYPE set to $AVR_TYPE"
@@ -28,4 +28,3 @@ avr-objcopy -O ihex -R .eeprom build/main build/main.hex
avrdude -F -V -c arduino -p $AVR_TYPE -P $1 -b $BAUD -U flash:w:build/main.hex
rm -r build

22
main.c
View File

@@ -3,11 +3,6 @@
#include "ard/serial.h"
#include "ard/pins.h"
#include "ard/util.h"
#include "servo/servo.h"
Servo servo1;
Servo servo2;
Servo servo3;
void prepare();
void loop();
@@ -23,18 +18,13 @@ int main(){
void prepare(){
pins_init();
serial_init(9600);
servo_init(7, &servo1);
servo_init(6, &servo2);
servo_init(8, &servo3);
pin_mode(13, OUTPUT);
}
void loop(){
servo_set(&servo1, 0);
servo_set(&servo2, 255);
servo_set(&servo3, 0);
_delay_ms(500);
servo_set(&servo1, 128);
servo_set(&servo2, 128);
servo_set(&servo3, 255);
_delay_ms(500);
digital_write(13, LOW);
_delay_ms(1000);
digital_write(13, HIGH);
_delay_ms(1000);
}