Ask a littleBits engineer

Hi David,

Yes, the Arduino bit should work with any USB Micro B cable. It is the same type of connector that is used on most Android mobile phones today.

Hi Sean,
Another quick question for you, is it possible to read the state of the 2 analog/pwm switches for outputs d5 & d9 in a sketch (.ino) program?

Thanks,
David

I was programming the littlebits arduino kit. But now the kit is not detected. what may be the problem?

Hello @therisingdip!

There may be an issue with your program, but here’s a few questions and a process to get your board back in action!

1.What type of computer are you using? Mac or Windows based?
2.Is this your first time connecting to the computer?
3.When you power the Arduino on, does the amber “d0/rx” blink? Have you tried to power on the module before you started programming/uploading?
4.Have you tried wiping your connector pins with a soft cloth?
5.Have you tried switching out the battery?

Try these steps!

Let us know if this helps!

hi, I’m trying the “Blink” sketch. The upload is not successful and I get this error:
avrdud: error: buffered memory access not supported. Maybe it isn’t a butterfly/AVR109 but a AVR910 device?

Hey @Karlo91,

Sorry for the issues you are having. Have you tried switching COM Ports of the USB adapter?
Try these troubleshooting steps:

First: Find the COMx used for your “Arduino Leonardo” in the “Device Manager” of Windows.
Second: Double click to see the properties of the device and go to the “Port configuration tab”
Third: enter in “Avanced Options” and deactivate “Use FIFO buffers”, and accept all changes.

Let us know if this helps!

Needed to deactivate FIFO buffers as you suggested. It works now. Thanks!

Glad it worked! Happy Coding!

I have just started to play with the Arduino module. I have some experience with the arduino and programming simple things like lights and motors. I was attempting a simple circuit to get started and can not get any results. I have a simple setup (USB power + Button) plugged into A0 on the arduino. On the other side I have the bright LED module stemming off of D5. My code is as follows:

void setup(){
pinMode(A0, INPUT);
pinMode(5, OUTPUT);
}

void setup() {
if (digitalRead(A0 == HIGH)) digitalWrite(5, HIGH);

else (digitalWrite(5, LOW);
}

Any ideas why this may not be working?

Hi Alfonzo,

I think the problem might be with this bit of code:

digitalRead(A0 == HIGH)

The function digitalRead returns the value of the pin number you pass it as an argument. In this case you are pasasing the function A0 == HIGH and that will likely evaluate to 0, so you are actually passing it digitalRead(0).

What you likely want to replace that with is:

HIGH == digitalRead(A0)

This compares the value returned by digitalRead(A0), which will be either HIGH or LOW.

Hopefully that works!

That worked! Thank you. One more question if it is not a hassle. I tried to add a delay(1000); afterwards to get the light to stay on for a second before then turning off, but it gave me an else without previous if error. When constantly reading a button is it not possible to put a delay in? If so how would you recommend creating a button that turns a light on for 1 second and then off until pressed again?

Thank you for your help. I love this product but am still working on the programming aspect.

Hi Alfonzo,

It is hard to know what the issue is without seeing the code. Can you post your code here?

Love the Arduino coding kit and I’m having a blast. I do have a question, however. From what I’ve read, your Arduino board is basically a leonardo so I believe I should be able to connect to a serial lcd display and dhow my output that way. I’m an experienced programmer but new to electronics. I believe I should be able to snip a w1 wire and communicate over the tx output, yes? But what about power and ground? Do I need to snip another w1 for the power? The lcd instructions show only the three wires but I’m not sure where they should come from on the Arduino board.

Hi vbdevpro,

You can certainly communicate with a serial LCD using the Arduino module. The w1 wire is a bitsnap on both ends so you may not be able to directly connect to your LCD display with it. If you don’t already have one, a proto module will allow you to hook up to it. The proto module allows you to run wires from screw down terminals to external electronics. Here is a link to the proto module: http://littlebits.cc/bits/proto

Hi,
I’m really new to Arduino and I’m using it for a school project. I have made a set of code that I believe should work but came up with errors. It was a quick draft and surprisingly only got something around 15 errors. Here is the code and the errors:

void setup(){

pinMode(D5, OUTPUT ) ;
pinMode(D1, OUTPUT ) ;
pinMode(D9, OUTPUT ) ;
pinMode(A1, INPUT ) ;
pinMode(A0, INPUT ) ;
pinMode(D0, INPUT ) ;
int time = growTime ;
int growTime = ++time ;
digitalWrite(D5, HIGH) ;
digitalWrite(D9, HIGH) ;

}

void loop(){
if (time = 100) ;
{
digitalWrite(D1, HIGH) ;
delay(5000) ;
digitalWrite(D1, LOW) ;
}
delay(2000) ;
digitalWrite(growTime) ;
}

while (time = 100) ;{
delay(1) ;
digitalWrite(D5, LOW) ;
digitalWrite(D9, LOW) ;
}

if (time = 100) ;{
int time = 1 ;
int growTime = 1 ;
delay (1)
int time = growTime ;
int growtime = ++time ;
}

if (time > 100) ;{
delay (3000) ;
digitalWrite(D5, HIGH) ;
digitalWrite(D9, HIGH) ;
}

Errors:

Genius_Hour.ino: In function ‘void setup()’:
Genius_Hour:2: error: ‘D5’ was not declared in this scope
Genius_Hour:3: error: ‘D1’ was not declared in this scope
Genius_Hour:4: error: ‘D9’ was not declared in this scope
Genius_Hour:7: error: ‘D0’ was not declared in this scope
Genius_Hour:8: error: ‘growTime’ was not declared in this scope
Genius_Hour.ino: In function ‘void loop()’:
Genius_Hour:16: error: ‘time’ was not declared in this scope
Genius_Hour:18: error: ‘D1’ was not declared in this scope
Genius_Hour:23: error: ‘growTime’ was not declared in this scope
Genius_Hour.ino: At global scope:
Genius_Hour:26: error: expected unqualified-id before ‘while’
Genius_Hour:26: error: expected unqualified-id before ‘{’ token
Genius_Hour:32: error: expected unqualified-id before ‘if’
Genius_Hour:32: error: expected unqualified-id before ‘{’ token
Genius_Hour:40: error: expected unqualified-id before ‘if’
Genius_Hour:40: error: expected unqualified-id before ‘{’ token

Thanks for the help.

~Will

Hi, @ClanScorpia! To help you debug your errors, let’s start by changing the pin names that start with D to simply their number value. For instance, replace all D0 with 0. Next, let’s look at your variable “growTime”, which you first referred to in these 2 lines of code:

int time = growTime ;
int growTime = ++time ;

You need to declare growTime first and give it a value first before you try to refer to it. Also, move these lines of code to the beginning of the void loop, so you can continue to refer to these variables later in the void loop.

Now let’s talk semicolons. They are often the cause of errors, and that’s easy to fix. You’ve done a great job in placing them at the end of each line of code, in fact too good of a job in a couple places! :wink: What I mean is, you do not need a semicolon between the parentheses and squiggly bracket at the end of the first line of a while or if statement. Also you are missing one semicolon at the end of delay(1)

I think that should fix your runtime errors. :smile:

Thanks for the quick reply @JackANDJude! I did all the advise things and it completely lowered my total error count but left a few that I’ve figured out but don’t know how to fix. In the variables growTime and time they keep telling me the other one has not been declared yet no matter what order I put it in. The other errors are that there is an expected unqualified id before the ‘ifs’ for ‘whiles’. I’ll put in the updated code and errors.

Code:
void setup(){
pinMode(5, OUTPUT ) ;
pinMode(1, OUTPUT ) ;
pinMode(9, OUTPUT ) ;
pinMode(A1, INPUT ) ;
pinMode(A0, INPUT ) ;
pinMode(0, INPUT ) ;
int time = growTime ;
int growTime = ++time ;
digitalWrite(5, HIGH) ;
digitalWrite(9, HIGH) ;

}

void loop(){
if (time = 100)
{
digitalWrite(1, HIGH) ;
delay(5000) ;
digitalWrite(1, LOW) ;
}
delay(2000) ;
digitalWrite(growTime) ;
}

while (time = 100) {
delay(1) ;
digitalWrite(5, LOW) ;
digitalWrite(9, LOW) ;
}

if (time = 100) {
int time = 1 ;
int growTime = 1 ;
delay (1)
int time = growTime ;
int growtime = ++time ;
}

if (time > 100) {
delay (3000) ;
digitalWrite(D5, HIGH) ;
digitalWrite(D9, HIGH) ;
}

Errors:
void setup(){
pinMode(5, OUTPUT ) ;
pinMode(1, OUTPUT ) ;
pinMode(9, OUTPUT ) ;
pinMode(A1, INPUT ) ;
pinMode(A0, INPUT ) ;
pinMode(0, INPUT ) ;
int time = growTime ;
int growTime = ++time ;
digitalWrite(5, HIGH) ;
digitalWrite(9, HIGH) ;

}

void loop(){
if (time = 100)
{
digitalWrite(1, HIGH) ;
delay(5000) ;
digitalWrite(1, LOW) ;
}
delay(2000) ;
digitalWrite(growTime) ;
}

while (time = 100) {
delay(1) ;
digitalWrite(5, LOW) ;
digitalWrite(9, LOW) ;
}

if (time = 100) {
int time = 1 ;
int growTime = 1 ;
delay (1)
int time = growTime ;
int growtime = ++time ;
}

if (time > 100) {
delay (3000) ;
digitalWrite(D5, HIGH) ;
digitalWrite(D9, HIGH) ;
}

Errors:

Genius_Hour.ino: In function ‘void setup()’:
Genius_Hour:8: error: ‘growTime’ was not declared in this scope
Genius_Hour.ino: In function ‘void loop()’:
Genius_Hour:16: error: ‘time’ was not declared in this scope
Genius_Hour:23: error: ‘growTime’ was not declared in this scope
Genius_Hour.ino: At global scope:
Genius_Hour:26: error: expected unqualified-id before ‘while’
Genius_Hour:32: error: expected unqualified-id before ‘if’
Genius_Hour:40: error: expected unqualified-id before ‘if’

Hi Will,

Jude had you pointed in the right direction. Let’s go through the code line by line and see what is going on.

First issue is in your setup:
int time = growTime ;
int growTime = ++time ;

You are declaring the int called time and initializing it to growTime. The problem here is that growTime does not exist yet because you are declaring growTime on the next line. Additionally, time is a declaration that may already used by Arduino, so you may have name it something else. On top of this, if you plan on using growTime and time throughout the life of your code you should declare them globally. To do so, move these two lines above the void setup() function.

The next issue is in your void loop():
if (time = 100)
You probably want to check if the variable time is equal to 100 but that is not what is happening here. inside your if conditional you are setting time equal to 100. To compare it to the value 100 you need to use the == comparison operator.

Third problem are three loops and conditionals after your void loop():

while (time = 100) {
delay(1) ;
digitalWrite(5, LOW) ;
digitalWrite(9, LOW) ;
}

if (time = 100) {
int time = 1 ;
int growTime = 1 ;
delay (1)
int time = growTime ;
int growtime = ++time ;
}

if (time > 100) {
delay (3000) ;
digitalWrite(D5, HIGH) ;
digitalWrite(D9, HIGH) ;
}

These pieces of code do not exist in a function so they will not only never be executed but the compiler won’t know what to do with them and won’t be able to build your code. Your while statement is again not using a comparison operator as is your if statement. Additionally you appear to be trying to redeclare variables time and growTime which will also cause errors on compile. Again, declare time and growTime once at the top of your file, above the void setup() function. Every time you reference or set those variables afterwards, do not include int in front of it.

I hope this helps you a bit!

@ClanScorpia Sean and Jude pointed out all the remaining errors, but I just have some extra suggestions for when you’re coding in the Arduino:

  • Compile/Verify your code often! If you’re not sure if what you’re writing is error-free, it’s best to go step by step and press Verify so you keep the error count low. This also helps you to fix these faster.

  • Make sure that every left-parenthesis in your code has a right-parenthesis counterpart, and vice-versa. For every {, ( or [ in your code there must also be a corresponding }, ) or ].

  • Always place semicolons at the end of an instruction, like Jude pointed out.

The biggest lesson you can learn when you’re getting started in programming is that it’s best to go slowly and make sure everything works as you go, rather than writing everything at once and not knowing which parts are filled with errors. :relaxed:

First of all, thanks for all the help! I’ve been trying the Arduino community but it’s nothing even close to as good as this. I did all the recommended things but I’m still coming up on trouble with the 2 variables. They keep telling me I need to declare one another before the other no matter which one is first. Everything else works perfectly.

Code:

int tick = growTime ;
int growTime = ++tick ;
void setup(){
pinMode(5, OUTPUT ) ;
pinMode(1, OUTPUT ) ;
pinMode(9, OUTPUT ) ;
pinMode(A1, INPUT ) ;
pinMode(A0, INPUT ) ;
pinMode(0, INPUT ) ;
digitalWrite(5, HIGH) ;
digitalWrite(9, HIGH) ;

}

void loop(){

if (tick == 100) {
tick = 1 ;
growTime = 1 ;
delay (1) ;
tick = growTime ;
growtime = ++tick ;
}

if (tick > 100) {
delay (3000) ;
digitalWrite(5, HIGH) ;
digitalWrite(9, HIGH) ;
}
if (tick == 100)
{
digitalWrite(1, HIGH) ;
delay(5000) ;
digitalWrite(1, LOW) ;
}
delay(2000) ;
digitalWrite(growTime) ;
}

Errors ( 3! :blush: )

Genius_Hour:1: error: ‘growTime’ was not declared in this scope
Genius_Hour.ino: In function ‘void loop()’:
Genius_Hour:22: error: ‘growtime’ was not declared in this scope
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:121: error: too few arguments to function ‘void digitalWrite(uint8_t, uint8_t)’
Genius_Hour:37: error: at this point in file