mirror of
https://github.com/Kugelschieber/arduino-c.git
synced 2026-01-18 02:50:26 +00:00
Moved arduino specific C files and started working on PWM.
This commit is contained in:
4
compile
4
compile
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir build
|
||||
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o build/serial.o -Wall serial.c
|
||||
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o build/pins.o -Wall pins.c
|
||||
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o build/serial.o -Wall ard/serial.c
|
||||
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o build/pins.o -Wall ard/pins.c
|
||||
avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o build/main.o -Wall main.c
|
||||
avr-gcc -mmcu=atmega328p build/*.o -o build/main
|
||||
avr-objcopy -O ihex -R .eeprom build/main build/main.hex
|
||||
|
||||
18
main.c
18
main.c
@@ -2,8 +2,8 @@
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdio.h>
|
||||
#include "serial.h"
|
||||
#include "pins.h"
|
||||
#include "ard/serial.h"
|
||||
#include "ard/pins.h"
|
||||
|
||||
void prepare();
|
||||
void loop();
|
||||
@@ -27,8 +27,11 @@ void prepare(){
|
||||
pin_mode(8, INPUT);*/
|
||||
|
||||
// anlog input example
|
||||
pin_mode(A1, INPUT);
|
||||
pin_mode(A2, INPUT);
|
||||
/*pin_mode(A1, INPUT);
|
||||
pin_mode(A2, INPUT);*/
|
||||
|
||||
// PWM example
|
||||
pin_mode(3, OUTPUT);
|
||||
}
|
||||
|
||||
void loop(){
|
||||
@@ -41,11 +44,14 @@ void loop(){
|
||||
}*/
|
||||
|
||||
// anlog input example
|
||||
int analog1 = analog_read(A1);
|
||||
/*int analog1 = analog_read(A1);
|
||||
int analog2 = analog_read(A2);
|
||||
char out[15];
|
||||
sprintf(out, "%d %d", analog1, analog2);
|
||||
serial_write(out, 15);
|
||||
serial_write(out, 15);*/
|
||||
|
||||
// PWM example
|
||||
digital_write(3, HIGH);
|
||||
|
||||
_delay_ms(25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user