pwm

Arduino on the STM8 (8 bit processor)
Post Reply
fastlink30
Posts: 2
Joined: Wed Nov 28, 2018 8:08 pm

pwm

Post by fastlink30 » Wed Nov 28, 2018 8:14 pm

How to set pwm on stm8?
what pin i can use for pwm?
i looked documentation but i see nothing about it, or example, is it supported?
is possible use st-link to debug?

it's my first project with stm8 & a sduino

thanks

.rpv
Posts: 10
Joined: Thu Sep 22, 2016 11:33 pm

Re: pwm

Post by .rpv » Sun Dec 02, 2018 11:55 pm

Hi, the sduino wiki includes the documentation that you are asking:
stm8blue-pinout.png
stm8blue-pinout.png (63.49 KiB) Viewed 215 times
https://tenbaht.github.io/sduino/hardware/stm8blue/


It's as straight forward as it sounds, I ran this code using an analog pin and a pwm too:

Code: Select all

/* STM8.ANALOG.PWM; */
byte LED=PC3;//.pwm;
byte ap=PC4;//.Analog;
void setup(void){
	pinMode(ap,INPUT);
	pinMode(LED,OUTPUT);
}
void loop(void){
	int c=analogRead(ap);
	analogWrite(LED,map(c,0,1023,0,255));
	delay(100);
}
it works, of course.

Post Reply