Calculator with serial communication problem.

I need

Hello,

I am using this code, and in the serial monitor it returns a -1 :frowning: with our even receiving input.

int SerialMath = 0;

void setup(){
  
  pinMode(13, OUTPUT);
  Serial.begin(9600);

}

void loop(){
    SerialMath = Serial.read();
Serial.println(SerialMath);
}

It loops and just says -1 a million times. I edited my code and put in the void setup and no hope, it did nothing. I want to send a simple problem through serial port (com3), but when I send the information, I get -1. I am new at arduino and am testing the waters if you will.

I created a simple vb.net application that will send the math problem, but I also have been trying to use the serial monitor.

All I want to do is turn my arduino into a simple calculator. I want to send it a problem through the serial port, and it send me back the answer.I just got a little hung up.

Thanks guys!

@KJACCH

Take a look at my serial Arduino calculator
http://forum.arduino.cc/index.php?topic=147550.msg1108495#msg1108495

Feel free to butcher what you need.

Ray

Wow thank you! thats really cool!

But is their a way to just send the problem to the arduino?

example = 3+3

then it should reply with 6.

Can it just take the string I send it, and compute?

To be honest, I am also new at programing c++. But I did in-fact look a little at your code and learned a bit from it.

Set verbose OFF

The problem is submitted as:

Add 3 3

The response is 6.00 (or whatever the decimal place setting is currently)

Ray

Load the sketch & play. The sketch is open, so you can add your own functions if desired.

As a Ham, you may find this fun, too:
http://forum.arduino.cc/index.php?topic=168886.0

Ray

haha wow,Ill show this link at the club! It wont upload a script. The TX was on and would not except an upload. My new project is to get this thing to work again. hahaha. Now the power LED is just on and no other LED and will not RX an upload.

help again?

By splitting your last question (why can't I upload) across two threads you make it more difficult to help you. Please do not do it again.

Replies go here... Arduino Wont upload script. - IDE 1.x - Arduino Forum