mirror of
https://github.com/Kugelschieber/arduino-c.git
synced 2026-01-18 02:50:26 +00:00
First working version of PWM.
This commit is contained in:
6
main.c
6
main.c
@@ -33,9 +33,11 @@ void prepare(){
|
||||
|
||||
// PWM example
|
||||
pin_mode(A1, INPUT);
|
||||
pin_mode(3, OUTPUT);
|
||||
pin_mode(6, OUTPUT);
|
||||
}
|
||||
|
||||
unsigned char pwm = 0;
|
||||
|
||||
void loop(){
|
||||
// digital input/output example
|
||||
/*if(digital_read(10) && digital_read(8)){
|
||||
@@ -54,7 +56,7 @@ void loop(){
|
||||
|
||||
// PWM example
|
||||
int analog = map(analog_read(A1), 0, 1023, 0, 255);
|
||||
analog_write(3, analog);
|
||||
analog_write(6, analog);
|
||||
|
||||
char out[15];
|
||||
sprintf(out, "%d", analog);
|
||||
|
||||
Reference in New Issue
Block a user