Shift register 74HC595 code issue


I’m trying to connect my core to some shift registers to increase the digital out pins. I’ve found a bildr tutorial on usging the 74HC595 shift register for arduino:

When i try to implement the code for the core it doesn’t compile. I changed the the pin numbers to D3,D4 and D5 but further i kept the code as much as possible as it is. When i try to compile i get the following:

…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp:20:1: error: ‘boolean’ does not name a type
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp: In function ‘void clearRegisters()’:
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp:37:6: error: ‘registers’ was not declared in this scope
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp: In function ‘void writeRegisters()’:
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp:51:15: error: ‘registers’ was not declared in this scope
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp: In function ‘void setRegisterPin(int, int)’:
…/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.cpp:63:3: error: ‘registers’ was not declared in this scope
make: *** […/596b0f706f0ab86a556db558a2384dbb75e2e981f453001caa07df6adef4/the_user_app.o] Error 1

it refers to the following line:

boolean registers[numOfRegisterPins];

but i don’t see what it wrong in the declaration. Can someone help out?

in addition, later on in the process i’m looking to try to implement the shift register library on the core: I tried as well but haven’t had success with this yet (it compiled but the core stopped functioning after uploading and had to be rebooted). So if someone has experience with this help would be appreciated.



Hello @ruben_vleuten
Replacing boolean with bool does the trick.

1 Like

Thanks @mohit, do you also know why this is?

You can also add this at the top of your code to avoid renaming all of the boolean types to bool

#define boolean bool

The Spark IDE just doesn’t know what boolean is yet. They are adding it to the list of supported types soon enough :wink:

1 Like