I am doing project of remote engine control by website. But first what I have to do is make a program od arduino.
The frequency will be set via the browser and engine will be obvers and revers.
First I make a diod control prototype.
Welcome to the Forum. Your English is just fine. It would be good for you to read this. Pay particular attention to point 6. I have formatted/posted your code for you so that others may see it. You'll get more help that way as many will not follow a link.
#define awersSilnika 8
#define rewersSilnika 9
long odebraneDane = 0;
long czasPracySilnika = 100000; // 100 sekund
Serial.setTimeout(czasPracySilnika); //po tym czasie SerialparseInt zwraca zero, bez ustawienia tego parametru zwraca zero po sekundzie.
Serial.begin(9600); //Uruchomienie komunikacji portu szeregowego
pinMode(awersSilnika, OUTPUT); //Konfiguracja wyjść
digitalWrite(awersSilnika, LOW); //stan poczatkowy LOW
if(Serial.available() > 0)
odebraneDane = Serial.parseInt();
Initial characters that are not digits or a minus sign, are skipped; Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; If no valid digits were read when the time-out (see Serial.setTimeout()) occurs, 0 is returned;
So parseInt() will read characters until it encounters a non-digit OR timeout is reached. The default timeout is 1 second.
I guess that you are sending stuff across the serial port to the board - otherwise the code will always timeout. So make sure that each integer you are sending is followed by a non-digit character.
So make sure that each integer you are sending is followed by a non-digit character.
If you are using the Serial Monitor application to send data, it can be configured to append a carriage return or line feed or both to what you type in, all of which qualify as "a non-digit character".
If you are using some other app to send the data, make that app send a non-digit after the value.