Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with libraries #35

Closed
ystrem opened this issue Dec 18, 2014 · 8 comments
Closed

Problem with libraries #35

ystrem opened this issue Dec 18, 2014 · 8 comments
Milestone

Comments

@ystrem
Copy link

ystrem commented Dec 18, 2014

Hello, I have problem with libraries. I can't get work the Serial work. The same I get when I try another library.

Code :

include <Arduino.h>

void setup(void)
{
// start serial port
Serial.begin(9600);

}

void loop(void)
{

}

pioenvs/arduino_pro5v/src/main.c: In function 'setup':
.pioenvs/arduino_pro5v/src/main.c:6:3: error: 'Serial' undeclared (first use in this function)
Serial.begin(9600);
^
.pioenvs/arduino_pro5v/src/main.c:6:3: note: each undeclared identifier is reported only once for each function it appears in
scons: *** [.pioenvs/arduino_pro5v/src/main.o] Error 1

@ystrem
Copy link
Author

ystrem commented Dec 18, 2014

Or if I install OneWire lib and only include it to empty project I get this.

CODE :
#include <Arduino.h>
#include <OneWire.h>
void setup(void)
{
// start serial port
//Serial.begin(9600);
}

void loop(void)
{

}

Error:

ystrem@ystrem-PC:~/test$ platformio run
Processing arduino_pro5v environment:
avr-gcc -o .pioenvs/arduino_pro5v/src/main.o -c -g -Os -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=158 -DARDUINO_AVR_PRO -I.pioenvs/arduino_pro5v/FrameworkArduino -I.pioenvs/arduino_pro5v/FrameworkArduinoVariant -I.pioenvs/arduino_pro5v/OneWire_ID1 .pioenvs/arduino_pro5v/src/main.c
/usr/local/lib/python2.7/dist-packages/pkg_resources.py:2425: RuntimeWarning: 'xdiagnose (3.6.3build2)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
RuntimeWarning,
/usr/local/lib/python2.7/dist-packages/pkg_resources.py:2425: RuntimeWarning: 'python-debian (0.1.21-nmu2ubuntu2)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
RuntimeWarning,
In file included from .pioenvs/arduino_pro5v/src/main.c:2:0:
.pioenvs/arduino_pro5v/OneWire_ID1/OneWire.h:112:1: error: unknown type name 'class'
class OneWire
^
.pioenvs/arduino_pro5v/OneWire_ID1/OneWire.h:113:1: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
{
^
scons: *** [.pioenvs/arduino_pro5v/src/main.o] Error 1

@ivankravets
Copy link
Member

Hello,

Which is extension of your file? main.c or main.ino?

  • If you use main.c, you should include arduino header file:
#include <Arduino.h>
  • You can change extension to main.ino, then PlatformIO will automatically include arduino header files.

@ystrem
Copy link
Author

ystrem commented Dec 18, 2014

It help to change from main.c > main.cpp or main.ino. Now is working. Is possible to upload code by usbasp ? If I set proper env upload_port ?

@ivankravets
Copy link
Member

It help to change from main.c > main.cpp or main.ino. Now is working.

Thanks for reporting 👍

Is possible to upload code by usbasp ? If I set proper env upload_port ?

I hope, that you can upload it. Can you test it and report me? Thanks a lot!

@ystrem
Copy link
Author

ystrem commented Dec 18, 2014

It's not possible.

@ystrem ystrem closed this as completed Dec 18, 2014
@ivankravets
Copy link
Member

Stop stop... Why not?

  1. Did you specify usbasp protocol?
  2. Can you share here your platformio.ini?

Try:

[env:some_env]
platform = atmelavr
framework = arduino
upload_protocol = usbasp

@ivankravets ivankravets reopened this Dec 18, 2014
@ystrem
Copy link
Author

ystrem commented Dec 19, 2014

I tried it and it looks good.

platform = atmelavr
framework = arduino
upload_protocol = usbasp -B5
board = pro8MHzatmega328

avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f
avrdude: reading input file ".pioenvs/pro8MHzatmega328/firmware.hex"
avrdude: writing flash (1068 bytes):
avrdude: 1068 bytes of flash written

avrdude: safemode: Fuses OK (H:05, E:DA, L:E2)

avrdude done.  Thank you.

@ivankravets
Copy link
Member

@ystrem thanks a lot for your platformio.ini and report. I've just added it to platformio.ini examples (number 5).

Have a nice weekend! 👍

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

No branches or pull requests

2 participants