Professional Documents
Culture Documents
Bluethoth PWM
Bluethoth PWM
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
String senal;
int dato=3;
void setup() {
// put your setup code here, to run once:
pinMode(dato,OUTPUT);
Serial.begin(9600);
mySerial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(mySerial.available()>0){
senal=mySerial.readString();
if(senal.startsWith("motor")){
senal.replace("motor","");
analogWrite(dato,senal.toInt());
Serial.println(senal.toInt());
}
}