I am new, so I am probably doing something I should not do. I simply trying to display a value for C ,
It complies with no problem. I have selected my Arduino Board "Arduino Uno Rev 4 Minima" and the port: /dev/cu.usbmodem14601. Is there something I am missing? I am trying to keep it simple to see if I can get the serial monitor to work. Mike
My code is:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
int a = 2;
int b = 2;
int c = a + b;
Serial .print (c);
}
void loop() {
// put your main code here, to run repeatedly:
It even works with the space . And the baudrate has no meaning because the R4 Minima has a native USB port.
@makeors : which IDE version are you using? The problem is, that USB connection must be established after upload, and that takes time. You need to wait after the Serial.begin:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while(!Serial);
int a = 2;
int b = 2;
int c = a + b;
Serial .print (c);
}
void loop() {
// put your main code here, to run repeatedly:
}
Another point is, that after uploading, the port cannot be opend ( because the connection is not yet astablished. This at least with IDE 1.8.9 . You must close and reopen the monitor after uploading.
[Edit] With IDE2 it works directly after uploading ( but waiting with 'while' is mandatory!)..