Go Down

Topic: Trying to use binary number (B10000) in lib and getting error. (Read 967 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 for Arduino 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy