Serial does not work with panStampAVR board #144

Closed
Absurd-Mind opened this Issue Mar 29, 2015 · 3 comments

Projects

None yet

3 participants

@Absurd-Mind

Serial does not work when trying to compile for a panStampAVR board.

This is the test code (test.ino)

void setup() {
    Serial.begin(9600);
}

void loop() {
}

and this is the compiler output:

$ platformio run
[Sun Mar 29 10:30:10 2015] Processing panStampAVR (platform: atmelavr, board: panStampAVR, framework: arduino)
-------------------------------------------------------------------------------------------------------
avr-g++ -o .pioenvs/panStampAVR/src/test.o -c -fno-exceptions -fno-threadsafe-statics -g -Os -Wall -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=8000000L -DPANSTAMP_AVR -DARDUINO=10601 -DPLATFORMIO=010200 -I.pioenvs/panStampAVR/FrameworkArduino -I.pioenvs/panStampAVR/FrameworkArduinoVariant .pioenvs/panStampAVR/src/test.cpp
test.ino: In function 'void setup()':
test.ino:2:5: error: 'Serial' was not declared in this scope
scons: *** [.pioenvs/panStampAVR/src/test.o] Error 1
===================================== [ ERROR ] Took 0.48 seconds =====================================
@valeros
Member
valeros commented Mar 29, 2015

It is weird. "Serial" is not defined by default.

Solution

You can try #include <HardwareSerial.h> before using the Serial object.

From panStamp forum: "HardwareSerial.h is not included by default in the sketches in order to save some memory when the UART is not needed."

@valeros valeros was assigned by ivankravets Mar 29, 2015
@ivankravets ivankravets added this to the 1.4.0 milestone Mar 29, 2015
@Absurd-Mind

So this is behaviour by design. Maybe this should be added in the documentation/examples.
Thank you for the help and the awesome tool!

@ivankravets
Member

@Absurd-Mind thanks a lot for your report 👍

I've just created PlatformIO FAQ page and with "Troubleshooting" section. Here is your first question: http://docs.platformio.org/en/latest/faq.html#serial-does-not-work-with-panstampavr-board

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment