Programming Codebug

Introduction

Downloading your programs to CodeBug is really easy, this guide will show you how.

You will need
CodeBug CodeBug
Micro USB cable
Computer
CR2032 battery (optional)

6 Questions

Plugging in CodeBug

Plug the Micro-USB cable into a USB-port on your computer. While holding down button A on your CodeBug, plug the other end of the Micro-USB into the socket on CodeBug. The LED in the top left of CodeBug’s LED display will flash when CodeBug is ready. You can now let go of button A.

Note: There are separate instructions below for programming CodeBug with the battery inserted.


8 Questions
  • How long should mounting take? My light stays steady (never flashes) and no drive shows up... Phi Sanders @ Aug. 6, 2015, 3:29 a.m.

    • I tried a different cable and it worked! There is virtually no delay before the LED flashes and the codebug mounts as a disk now. — Phi Sanders @ Aug. 6, 2015, 3:58 a.m.

    • Some USB cables only supply power and do not transmit data (so can't be used for programming CodeBug). We have added this note to the guide. Thanls :) — Thomas Macpherson-Pope @ Aug. 11, 2015, 1:31 p.m.

    • Using the provided USB lead it does not show up on my El Capitan Mac, but with the same lead it shows as a drive on my Asus. — Rick Harding @ Oct. 31, 2015, 5:10 p.m.


    For the first time it took about 3 seconds for light to start blinking. Now it is almost instant (1 sec). Drive appears in about 5 seconds on windows 7 64bit. No driver was necessary. V.T. Marvin @ Dec. 27, 2015, 10:11 a.m.
    • cool — sreyner @ Sept. 26, 2016, 11:17 a.m.


    Same as V.T.Marvin for me exept I use Lunix Mint version17.3 Guerinboys @ Dec. 23, 2016, 7:08 p.m.

    -1
    Having just received mine, it takes no more than a couple of seconds for the drive to appear. I am using Linux, Windows may need to install a driver when it is first plugged in. Are you using a data cable or a power-only cable? Gregory Fenton @ Sept. 16, 2015, 1:19 p.m.
    • Well, the red light remain steady on forever. ANd I verified that the cable I use indeed is a DATA cable, not a power one. — jfmessier @ Sept. 23, 2015, 1:19 a.m.

    • cool — sreyner @ Sept. 26, 2016, 11:18 a.m.


    Answer this question:

  • I have an old prototype codebug that was given to me last summer. Is this essentially the same beast? Can I program it the same way as the new codebug? I can plug it in with a USB cable and button A pressed but it is my top RIGHT light that flashes and then goes steady and I cannot see the USB drive on my PC. I have confirmed I am using a data cable with my tablet. laurence @ Oct. 1, 2015, 8:56 p.m.


    You can still program it, will also work the same way, just some things you can not do(like make sound). Cameron Barclay @ May 4, 2016, 12:53 a.m.



    Answer this question:

  • Is button A pressed just to enter programming mode? It seems the CodeBug (with no battery) will run a previously loaded program as soon as it is plugged into USB if button A is not pressed. Matt Sendorek @ Aug. 6, 2015, 11:15 p.m.

    • Yes, the USB cable provides power so that's why the program runs. You have to hold the button so that the CodeBug acts like a USB memory stick allowing you to copy on the code. — Andy Clark @ Oct. 2, 2015, 9:14 a.m.


    Yes holding button A while plugging in the cable lets CodeBug know it should go into programming mode. Otherwise it will run the user program that is already on it and just draw power from the USB. Thomas Macpherson-Pope @ Aug. 11, 2015, 1:33 p.m.

    Holding buttonA down while plugging it in prevents this from happening Matthew Mellor @ July 13, 2017, 3:05 p.m.

    Holding buttonA down while plugging it in prevents this from happening Matthew Mellor @ July 13, 2017, 3:05 p.m.

    Answer this question:

  • Whenever I connect the CodeBUG, in any way I tried, I never get the LED flashing, but steady ON. What Can I do ? jfmessier @ Sept. 12, 2015, 2:31 a.m.


    Yes, as I repeatedly said in my different problem reports, the cable is indeed a DATA cable, as it was used minutes before for connecting my smartphone and downloading pitcures. Looks to me like the data pins on the device are not working. jfmessier @ Sept. 15, 2015, 11:33 a.m.

    Have you tried testing your USB cable with a phone to check it carries data? Thomas Macpherson-Pope @ Sept. 15, 2015, 10:02 a.m.

    Answer this question:

  • Our first codebug broke its usb connector. It was replaced but really connectors should not be used as switches. Where is the documentation for how to load code and control codebug without (dis)connecting the fragile usb connectors? William Dodd @ Oct. 24, 2015, 6:41 p.m.


    It's in the "Loading program with battery" section below, but is applicable even without a battery. When connected via USB: * hold both buttons for at least 10 seconds (the LED display will turn off after 5 seconds so make sure hold the buttons for at least 5 seconds after that) * then let go of button B, making sure you keep A pressed * the programming indicator LED will begin to flash * you can then load your programs as normal by dragging them onto the CodeBug device. Make sure you do the full 10 seconds. Less than that won't work. Dan Halbert @ Nov. 11, 2015, 4:05 a.m.

    Answer this question:

  • I am using the USB cable that came with codebug and getting no flashing red light when pressing button "A" . I successfully downloaded two other programs before this with the same cable. help? — rlagos1 @ Jan. 10, 2016, 6:49 p.m.


    HI- thanks Thomas. Yes, I both held button down before and after plugging in and tried a different port. I realize now that the micro usb attachment on the codebug is loose and needs to be replaced. I will need to get it replaced. — rlagos1 @ Jan. 13, 2016, 7:05 p.m.

    are you holding down button A before and during plugging in the cable? try plugging into a different USB port. Thomas Macpherson-Pope @ Jan. 11, 2016, 10:30 a.m.

    Answer this question:

  • I don't quite understand the text? sreyner @ Sept. 26, 2016, 3:46 p.m.


    Well what he was saying is you hold A while you are plugging it in. timtim @ Sept. 30, 2016, 12:52 a.m.
    • Thanks! — sreyner @ Oct. 2, 2016, 11:12 a.m.


    Answer this question:

  • what USB should I use to plug in codebug? Nicolas Sandoval @ July 1, 2018, 1:03 p.m.


    Answer this question:

  • Ask a new question:

Loading your program

Now CodeBug is connected to your computer, much like a USB memory stick, you can drag your program onto CodeBug. If you have already made a CodeBug program, make sure you have downloaded it, or you can just click here to download a test program. Find your downloaded program file, and drag or copy it into where CodeBug appears on your computer’s folders.


6 Questions
  • deleted


    Answer this question:


  • I have a problem getting the device recognized as a storage device under Linux. I tried with a first cable that is KNOWN to carry data, as I used minutes ago to download pictures off my phone. But the Codebug, when connected did not show up on my computer. I was using a USB 3.0 hub. I then tried the cable that came with the Codebug on the same hub, no more results. Same on the USB 2 hub where my keyboard is connected. I then tried to a direct USB port on my computer, no hub whatsoever. Nothing more. I run Linux, but this should not matter. I thn though t about the fact that I was running a VM. Without the VM, same [problem. Tried connecting on a direct USB2 connection, same problem. I don't know whether this is a hardware defect or a OS compatibility, but it does not look under Linux. BTW: I use Ubuntu 15.04 64-bit. jfmessier @ Sept. 12, 2015, 2:24 a.m.

    • Open a terminal window and type in dmesg | tail This will give the last lines of information about the events in your computer. Plug the CodeBug in and type in the command again. If the message has changed from the first run, copy and paste it as a reply to my answer here. — Gregory Fenton @ Sept. 16, 2015, 1:23 p.m.

    • My PC running Ubuntu 15.04 64-bit sees my Codebug as a storage device provided that I hold down button A while plugging the USB cable into the PC. If I simply plug in the cable, or plug in the cable and then press button A, the bug isn't seen as a storage device. I think that this is what is it designed to do. — Tony Addyman @ Sept. 22, 2015, 1:13 p.m.


    Answer this question:

  • I can't download my file from website! Nasa1423 @ Sept. 23, 2015, 7:06 p.m.

    • Give us a clue! What operating system and version are you using (windows/linux/etc.)? What browser and version are you using (IE, Chrome, Firefox, Safari, etc.)? People will not answer your posts if they are just statements and not questions. — Roger James @ Oct. 14, 2015, 9:48 a.m.


    Answer this question:

  • Hi. All seems to run well from my Mac Book Pro. I downloaded 2 programs onto my USB-connected CodeBug device. Both show up on the CodeBug device initially. However, only one runs. How can I get my CodeBug to skip to the second downloaded program? Tried double-A presses & various other A/B combos to no avail. Thanks. Flo Wing @ Nov. 25, 2015, 5:15 p.m.


    You can only have one program on CodeBug at a time. However, you could put the blocks of both into a repeat while loop and check if button A or B is pressed and run the corresponding program Thomas Macpherson-Pope @ Dec. 10, 2015, 9:37 a.m.

    Answer this question:

  • I have click Save many times and click the share button but the program cannot found under www.codebug.org.uk/explore/codebug/3369/ it will Change to www.codebug.org.uk/explore/codebug/all/ and also the Program is lost and not saved günter thommes @ Dec. 9, 2015, 9:52 p.m.


    This project is set to private, you have to set it to Listed or Unlisted to share the link Thomas Macpherson-Pope @ Dec. 10, 2015, 9:39 a.m.

    Answer this question:

  • Does Codebug just remember one program at a time? How do you clear it to download or run a new program? Thanks Janelle Ziegler @ Aug. 13, 2016, 12:38 p.m.


    Answer this question:

  • -1

    After we press B and the program runs, codebug disapears from the windows explorer. How can we show codebug without unplugging and replugging codebug, which is a bit of a nuissance. Perna @ Sept. 13, 2015, 10:17 a.m.

    • Im sorry but you cant. You need to unplug and replug. — Emil Qvarnström @ Sept. 30, 2015, 7:24 p.m.

    • Im sorry but you cant. You need to unplug and replug. — Emil Qvarnström @ Sept. 30, 2015, 7:24 p.m.

    • Holding both buttons for 8-10 seconds and then releasing only button B worked for me. However, it genuinely has to be >=8 seconds. The LEDs will shut off earlier but you need to hold well past that. — Dan Halbert @ Oct. 1, 2015, 12:41 a.m.


    You can hold both buttons for 10 seconds then release button B. Thomas Macpherson-Pope @ Sept. 15, 2015, 10 a.m.

    Answer this question:

  • Ask a new question:

Reset CodeBug

When your program has finished loading, the LED in the top right of CodeBug’s display will turn on.

Reset CodeBug to start running your program by pressing button B. Your program will now be running.


4 Questions
  • When I press button B, my CodeBug disconnects from my computer (which complains that it should have been ejected before being disconnected). Does this matter? Is there a simple way of stopping it happening? Peter Wood @ Sept. 15, 2015, 10:36 a.m.

    • No I just put it back in — Reece Patterson @ Sept. 17, 2015, 6:36 p.m.

    • I agree you should put the Micro USB cable in your code bug! — sreyner @ Sept. 26, 2016, 4:32 p.m.


    This does not matter, CodeBug makes sure it is in a stable state when it resets (which is normally the role of the computer with USB memory sticks).. You could alternatively eject CodeBug on the computer. Thomas Macpherson-Pope @ Sept. 15, 2015, 11:19 a.m.
    • Thanks. — Peter Wood @ Sept. 15, 2015, 11:40 p.m.


    Answer this question:

  • After running a program once, how do we run it again? The program runs, then the LEDs are all unlit. I can't work out how to run the program again, whether connected via USB cable or with battery inserted. — JulianJJ @ Oct. 30, 2015, 10:43 a.m.

    • OK, I've worked out that if you press and hold buttons A and B together for 10 seconds, then release button A, the program runs again. Presumably the program is still "running", even though it's not showing anything, and pressing both buttons stops the program, and they you can start it again. Is this right, or is there a better way? Should the program stop by itself, without needing to press both buttons for 10 seconds? — JulianJJ @ Oct. 30, 2015, 11:03 a.m.


    If you want a program to run continuously, you need to put your program in a 'Repeat While true' block from the Loops menu. you can also add a 'sleep until button changes' block from the Basics menu to run your program each time a button is pressed. Thomas Macpherson-Pope @ Oct. 30, 2015, 11 a.m.

    dsaasd Antonio Pilo @ Sept. 21, 2018, 1:23 p.m.

    Answer this question:

  • Does anyone know why the Pros keep answering all of the questions and how to use a course? Guerinboys @ Dec. 23, 2016, 7:13 p.m.


    Answer this question:

  • Does anyone know why the Pros keep answering all of the questions and how to use a course? Guerinboys @ Dec. 23, 2016, 7:13 p.m.


    Answer this question:

  • Ask a new question:

Powering by battery

CodeBug can be powered by battery so you can take it wherever you want! To power CodeBug by battery, first unplug the Micro-USB cable, do not worry as CodeBug will remember your program without being plugged in. Now slide in a coin battery (CR2032) with the positive (plus symbol) side up. Your program will begin running again!


7 Questions
  • Can the USB cable and the battery be plugged in at the same time? Brian Corteil @ July 16, 2015, 11:54 a.m.

    • There is a section that states to load program with the battery installed you need to press both buttons for 10 seconds... From this I understand it should be OK to use the USB cable to program while a battery is used. I'm guessing they just don't recommend inserting a battery while the USB cable in plugged in. . — Steve Swindley @ July 17, 2015, 7:40 p.m.


    Simple answer is Yes! If you CodeBug has a battery inserted in the slot you can plug in a USB cable without any problems. Simon Holt @ July 28, 2015, 8:18 p.m.
    • I agree! — sreyner @ Sept. 26, 2016, 12:05 p.m.


    Yes, but to reset the CodeBug with a battery inserted you need to hold A and B together for at least 10 seconds. Gregory Fenton @ Sept. 16, 2015, 1:25 p.m.
    • I agree! — sreyner @ Sept. 26, 2016, 12:05 p.m.


    Yes! why not! Well, you might think it could break the code bug but it won't! sreyner @ Sept. 26, 2016, 11:37 a.m.
    • I do think so! — sreyner @ Sept. 26, 2016, 3:38 p.m.


    Answer this question:

  • Does a reset of the CodeBug (using both buttons A & B as described above) turn it off, so that it doesn't use up the battery? If not, is there any other way to turn it off? I would prefer not to have to take the battery in and out. Tony Addyman @ Sept. 22, 2015, 1:26 p.m.


    Holding A & B puts CodeBug into a very low power state, but it will still use some power. Removing the battery is the only way to ensure no power use Thomas Macpherson-Pope @ Sept. 23, 2015, 9:39 a.m.

    Answer this question:

  • How do you play the program with a battery in it or replay it? Thanks! SmileyFace11 @ Jan. 5, 2016, 10:30 p.m.


    You have to put a loop while true around your program. Be shure in the emulator that you have to push the play button only once. If you have to press it again, your loop is not functional. Walter Ampa @ April 15, 2016, 7:48 p.m.

    Answer this question:

  • what I mean, can you replay a program with the battery???? Thanks!! bye SmileyFace11 @ Jan. 5, 2016, 10:34 p.m.

    • Can you, I'm not sure? — sreyner @ Sept. 26, 2016, 12:07 p.m.


    For a program to repeat, it needs to be inside a Repeat while true loop from the Loops menu Thomas Macpherson-Pope @ Jan. 6, 2016, 9:55 a.m.
    • That's true! — sreyner @ Sept. 26, 2016, 12:08 p.m.


    I think you could though I'm not that sure yet! sreyner @ Sept. 26, 2016, 12:10 p.m.

    Hold down button A and B for 10 seconds. It will run your program again without a while loop. László Tarjányi @ April 18, 2017, 10:27 a.m.

    Answer this question:

  • Could you use the bug when the batter isn't in? sreyner @ Sept. 26, 2016, 12:13 p.m.


    Yep, you can power CodeBug by USB cable instead :D Thomas Macpherson-Pope @ Sept. 26, 2016, 3:34 p.m.
    • Thanks! — sreyner @ Sept. 26, 2016, 3:36 p.m.


    Answer this question:

  • Where do you get the EXTENSION HEADER and what is it? sreyner @ Sept. 26, 2016, 3:40 p.m.


    The extension header is the black plastic connector at the bottom of header, it let's you plug CodeBug onto a Raspberry Pi, or connect other electronics to CodeBug. Thomas Macpherson-Pope @ Sept. 27, 2016, 3:06 p.m.
    • Thanks! — sreyner @ Sept. 28, 2016, 7:26 a.m.


    Answer this question:

  • Can you power the CodeBug using the extension header? (for example, in situation where using a CR2032 isn't possible) James Langbridge @ Jan. 11, 2017, 1:39 p.m.


    Answer this question:

  • Ask a new question:

Loading program with battery

When the battery is in CodeBug, it is always on even when it is sleeping. So to get CodeBug into the programming mode, you must:

  • plug in CodeBug to your computer via USB

  • then hold both buttons for at least 10 seconds (the LED display will turn off after 5 seconds so make sure hold the buttons for at least 5 seconds after that)

  • then let go of button B, making sure you keep A pressed

  • the programming indicator LED will begin to flash

  • you can then load your programs as normal by dragging them onto the CodeBug device.


5 Questions
  • The above sequence doesn't work for me.- but what does is: - With USB disconnected, hold both buttons as described, then keep pressing button A - Only plug the USB cable in while pressing button A Mike Redrobe @ July 29, 2015, 1:23 p.m.


    What does work is a slightly different order: With USB disconnected, hold both buttons as described, then keep pressing button A Only plug the USB cable in while pressing button A Mike Redrobe @ July 29, 2015, 1:25 p.m.

    Answer this question:

  • Just a tip: Holding buttons A and B will visually stop the active program after approximately 5 seconds. To get the necessary 10 seconds continue holding both buttons pressed for at least another 5 seconds. Rob van den Hoff @ Sept. 30, 2015, 12:12 p.m.

    • Thanks for the feedback, we have added this tip to the activity — Thomas Macpherson-Pope @ Sept. 30, 2015, 2:41 p.m.


    Answer this question:

  • I left the battery in overnight, and the battery died. Is there a way to stop it other than removing the battery? Tom OBrien @ Dec. 18, 2015, 8:42 p.m.


    I think there is no other possibility for it than take out the battery and change it then put the new battery in the slot! sreyner @ Sept. 26, 2016, 12:33 p.m.

    Answer this question:

  • I have a program that waits until any key pressed. Then it draws something and clears the display and goes back to the waiting state. With a battery I couldn't reset the Code Bug as described here. When I release button B the drawing loop starts again. I tried with and without the cable plugged in first. No visual impression after five seconds. Any suggestions? Walter Ampa @ April 15, 2016, 7:56 p.m.

    • Workaround: remove battery, pess A, plug in. Not nice. — Walter Ampa @ April 15, 2016, 7:57 p.m.

    • Hello Walter, thank you for bringing this to our attention, we will investigate this issue and get back to you. — Thomas Macpherson-Pope @ April 18, 2016, 1:05 p.m.

    • Do you mean 'press' instead of 'pess' ? — sreyner @ Sept. 26, 2016, 12:37 p.m.

    • Same issue - I have "sleep until button changes" block - can't reset it using normal methods - have to hold down A and plug into USB. Not a huge deal now that I know, but confusing initially. — mrglue @ Nov. 20, 2016, 9:03 a.m.


    Answer this question:

  • Is it meant to flash after when you have taken your finger off the bug? Did it flash for you? If it's not meant to be flashing then what could have gone wrong?Could it have been the machine? sreyner @ Sept. 26, 2016, 4:41 p.m.


    Answer this question:

  • Ask a new question:

What next?

Now you can use CodeBug to create all kinds of amazing projects. Go to the learn page to find out how to make different things with CodeBug.


5 Questions
  • How can I program the codebug in javascript directly ? Frederick Vandenbosch @ Sept. 4, 2015, 6:55 p.m.


    I do not think that is possible joseph b @ Oct. 26, 2015, 8:25 p.m.

    From the kickstarter main page: "Drag and drop blocks to create your program (or edit the Javascript if you're a pro)" Frederick Vandenbosch @ Oct. 26, 2015, 8:32 p.m.

    I'm not quite sure if that's possible? sreyner @ Sept. 26, 2016, 12:39 p.m.

    What is javascript anyway? sreyner @ Sept. 26, 2016, 4:44 p.m.

    Also what do you mean by:How can I program the codebug in javascript directly ? sreyner @ Sept. 26, 2016, 4:46 p.m.

    "Buy a book on programing" is all I would say if someone dosen't know what JavaScript is!!! Guerinboys @ Dec. 23, 2016, 7:15 p.m.

    Answer this question:

  • . — HelloMyNameIsHamish @ May 2, 2016, 4:23 a.m.


    Answer this question:

  • . — HelloMyNameIsHamish @ May 2, 2016, 4:23 a.m.


    Answer this question:

  • What is javascript? sreyner @ Sept. 26, 2016, 4:48 p.m.


    Javascript is a programming language used heavily on the web, you can view your CodeBug Blockly programs in a Javascript equivalent on the Create page Thomas Macpherson-Pope @ Sept. 27, 2016, 2:59 p.m.

    Answer this question:

  • how do you use python? ianyu2008 @ March 31, 2017, 3:50 p.m.


    Answer this question:

  • Ask a new question:

Back to top