I have an arduino program that only does serial communications with a little bit of math, and I am writing another one to communicate with it on a second arduino. For testing purposes I was hoping I could run the serial only program on my desktop. I know it is possible to run on a raspberry pi but I have never done that. Can I do something similar on windows? If not, can anybody recommend the easiest way to do this with a regular C++ program that would require very little editing? Here is a copy of my code if it's helpful. It basically increments a variable up and down between 0 and 100.
int pos = 60;
bool flag=0;
int dly=50;
int vel=0;
const int buttonPin = 12; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(115200);
}
void loop() {
dly=50;
buttonState = digitalRead(buttonPin);
if (buttonState==0)dly=12;
Serial.print(vel); //speed
Serial.print(",");
Serial.println(pos); //position
delay(dly);
if (pos==30)flag=1;
if (flag==1) pos+=1;
if (pos==100)flag=0;
if (flag==0) pos-=1;
vel=1000/dly;
if (flag==0) vel*=-1;
}