hi,
in a sketch (*.ino) I can use OUTPUT, HIGH, LOW, etc. without any "#define" before.
But in a C-file OUTPUT, HIGH, LOW, etc. are unknown.
What includes are necessary to use them in a C-file?
SupArdu
hi,
in a sketch (*.ino) I can use OUTPUT, HIGH, LOW, etc. without any "#define" before.
But in a C-file OUTPUT, HIGH, LOW, etc. are unknown.
What includes are necessary to use them in a C-file?
SupArdu
What includes are necessary to use them in a C-file?
#include "Arduino.h"
or
#include <Arduino.h>
hi,
thank you, but problems continue:
In the C-file, display_MI.c, I am using SPI and Wire:
#include <SPI.h>
#include <Wire.h>
...
The compiler then reports many errrors, e.g.
In file included from display_MI.c:5:0:
C:\ZusProgs\arduino-1.6.5-r5\hardware\arduino\avr\libraries\SPI/SPI.h:72:1: error: unknown type name 'class'
class SPISettings {
^
C:\ZusProgs\arduino-1.6.5-r5\hardware\arduino\avr\libraries\SPI/SPI.h:72:19: error: expected '=', ',', ';', 'asm' or 'attribute' before '{' token
class SPISettings {
^
C:\ZusProgs\arduino-1.6.5-r5\hardware\arduino\avr\libraries\SPI/SPI.h:156:1: error: unknown type name 'class'
class SPIClass {
^and many more
If I copy the code from the C-file to my ino file and delete the C-file then the compiler reports no errors.
Is'nt it possible to use SPI functions and Wire function within an C-file?
In the C-file, display_MI.c, I am using SPI and Wire:
No, you are not. Those files define classes. C doesn't know classes from grape juice.
What PaulS is saying; you're using CPP stuff in a C file and that does not work. Rename your files to CPP and I suspect that it will work.
Or just stick to C and rewrite the libraries ![]()
Oh dear, of course, C and C++ is different ![]()