Ask a littleBits engineer

You are getting closer! You still need to declare growTime before you declare tick. Just look at your very first line and picture your program doing each line one at a time:

int tick = growTime ;

This is the first thing the program will attempt to process. You are declaring a variable called tick and initializing it as growTime. But what is growTime? At this point in the program it doesn’t exist yet. It is declared (i.e. brought into exists) on the next line! I’m not really sure what the end goal of the project is but check out this code with explanation:

int tick = 0; //Declare tick and set it equal to zero
int growTime = ++tick; //tick increments to 1. growTime is set to 1.

Now both tick and growTime equals 1 (Again I am not certain this is your intent).

Let’s check your loop code. I can tell you now that all that will happen is the following two lines:
delay(2000) ;
digitalWrite(growTime) ;

Why do I know this? Nothing is incrementing tick, so tick will forever be equal to 1! if you want those conditionals to hit, you must increment tick somewhere outside those conditionals. Finally, of those two lines we reach one of your errors: too few arguments to function ‘void digitalWrite(uint8_t, uint8_t)’. Your digitalWrite(growTime) is the culprit here. It must take two arguments. The first is the pin you want to control. The second is the value.

Hope this helps and good luck!

Well, my intent is to make the variable tick go up by one every 2 seconds. I took a guess and used a digitalWrite line. The ++tick seemed like a good value for what my purposes were. If that helps it would be super useful.

Hi Sean,

Can I connect the DC Motor directly to the Arduino and control the speed of the motor through an analogWrite?

Any help welcome.

Regards,

Bill

Hi Bill,

Yes, using of the analog outputs you can control the speed of the DC motor using the analogWrite function in arduino.

Any suggestions on writing a variable to the number module? Number Module as Arduino Counter

You can use two methods. 1) use the built-in map function to change the number you want to output (0-99) to a value to analogWrite to the pin the number bit is attached to:

analogWrite(9, map(value, 0, 99, 0, 255))

However, 2) I find using @sean_littleBits lookup table to be more stable.

ps, I will expound in your other thread about your sketch.

1 Like

Can I use a USB power brick that has 4 2.1amp outputs or one of the battery packs intendrd for phones to connect my little bits USB power module?

Hi shaiss,

As long as your USB power brick has an DC output voltage of 5 volts (and it should), it should be safe to use with the p3 power module.

I am now uploading ‘blinks’ to my w6 arduino on Mac. But the serial port can not be found. The arduino IDE shows that’at cc.arduino.packages.uploaders.SerialUploader.waitForUploadPort(SerialUploader.java:245)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:128)
at processing.app.debug.Compiler.upload(Compiler.java:165)
at processing.app.Sketch.upload(Sketch.java:1167)
at processing.app.Sketch.exportApplet(Sketch.java:1141)
at processing.app.Sketch.exportApplet(Sketch.java:1113)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:745)’
I have changed the usb cable for several times.But it still can not work.What can I do?

Does littlebits offer svg files for their modules? Particularity the proto , perf, and bitsnap.

I’m designing my first module and use frittzing for all my breadboard predesign. I was hoping to be able to import those HDK modules into my designs.

Thank you,

Hi shaiss,

We do not generate svg files for all of our modules but we do publicly share board files for them which will give you a starting point. I believe fritzing has some level of support for brd files.

Here is a link to our public repository where you can find board files for all of our modules.

I found the perf and proto hardware files in brd format. And yes, the fritzing team has built a brd2svg converter https://github.com/fritzing/eagle2fritzing/tree/master/brd2svg, but it has to be compiled first and not something I’ve had good luck with in the past.

Would it be possible to ask the littlebits team to make an SVG available for the proto and perf modules? These are really the only 2 modules that would be really usefull in Fritzing? The BitSnaps would be nice too, but not required.

Any help on that would be greatly appreciated!

UPDATE:
I was able to find an SVG export for Eagle: http://www.cadsoftusa.com/downloads/file/eagle2svg-1.4.1.ulp. After hiding some layers in Eagle then editing in Inkscape, I can get the board design into Fritzing. What I’ll have to do next is take the photo image of the perf/proto module and turn that into an SVG. I hope the littlebits team can help here as I have to think they have all those files handy and can do it quicker than I can.

Hi The mBlock/mBot folks just released their source code for their Scratch extensions. They are very focused on robotics and so may help you get a leg up on extensions for moving servos and such. The link to the source code is https://github.com/Makeblock-official/mBlock/tree/master/source I would love to see more littleBits specific extensions that could help us to program littleBits robots in Scratch.

Hi @sean_littleBits. I’m trying to create a sequence of lights (12 RGB lights) snapped together to indicate a growing number. It seems to me that if they are snapped together, a dimmer bit could control the voltage and that the lights closest to the power bit would alight and the further lights would light as the dimmer switch is turned and they get enough juice.

Is there a way to do this “behind the scenes” with an Arduino bit?
~Bridget (we met at a #HackPack session in September)

Hi Bridget!

I am assuming you are speaking in regards to raw LEDs and not our LED module so I am answering in that regard.

The issue with stringing together a series of LEDs is that they will each drop an equivalent amount of voltage in series. As a result they will all hit their active region at the same time so by increasing voltage all that will happen is they will all go from off, to dim, to fully on together.

An example of how to get individual LEDs to reliably turn on sequentially can be found in our bargraph module. We use a series of comparators to turn on each LED individually as the input voltage surpasses a threshold. Here is the link to the schematic of the bargraph. I hope this helps!

Thanks for the speedy reply @sean_littleBits. I’m snapping together 12 RGB LEDs and making semi-simulating a traffic light that will go from red to yellow to green.

I’ll look at inserting logic bits between the RGB LEDs so the 4 reds can go on together, then the yellows, then the greens.

Hi Bridget @Thingfully,
Using an Arduino bit as mentioned will give you lots of possibilities of changing the timing between red, yellow and green. Also flashing a light will be possible… Or different times between each red-yellow-green cycle…
The Arduino has three outputs, so you could connect 4 RGB bits to each output, and set them to red, yellow and green… :traffic_light:

1 Like

Hi Bridget,

If you would like to do it by controlling raw voltage you could accomplish it with 2 thresholds, 1 XOR, and 1 Inverter. Set one threshold to 2V and the other to 4V. Take the 2V one and split it, one end in the XOR and the other in the inverter. The inverter will then go to your RED LEDs. Split the 4V threshold and put one straight into the GREEN LEDs and the other to the other input of the XOR. Finally attach the XOR to the YELLOW LEDs. This should give you RED below 2 volts, YELLOW between 2 volts and 4 volts, and GREEN between 4 and 5 volts.

There are a bunch of other ways to do this with logic gates. Let me know if you need any other ideas.

1 Like

Hi @sean_littleBits. How about 12 gradations rather than 3 (i.e., four shades each of red, yellow and red)? Maybe break out to a perf board? Im not sure how to signal the individual lights?