Go Down

Topic: Trying to use binary number (B10000) in lib and getting error. (Read 911 times) previous topic - next topic

scswift

I tried to use PORTB &= ~B10000; in WaveHC.cpp and I get "B10000 not declared in this scope".  Do I have to include some library to use these constants?  Which one?

Also, it can't find the SPI library either.  How do I specify the include for that?  #include <SPI.h> doesn't work.

marco_c

The binary numbers Bxxxxxxxx (8 digits) are defined in the headers for Arduino.

You can either expand yours to be 8 binary digits (B00010000) or just use the standard C convention 0b10000 (same way as 0x prefix would be used for hex numbers).
Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

WizenedEE


You can either expand yours to be 8 binary digits (B00010000) or just use the standard C convention 0b10000 (same way as 0x prefix would be used for hex numbers).


eight digit binary (like B00010000) are also defined in Arduino.h. I don't think 0b... is standard C, I think it's a gcc extension.

OP, just add
Code: [Select]

#include <Arduino.h>

at the top of the header file.

pYro_65

Here is a link to a post I made on Tom Torfs binary number macros.
It allows similar '0b' notation but is not compiler specific.

http://arduino.cc/forum/index.php/topic,93201.msg700368.html#msg700368

Go Up