Questions tagged [bbc-microbit]

The BBC micro:bit is a small but yet powerful learning computer for kids and grown ups.

The BBC micro:bit is a small but yet powerful learning computer for kids and grown ups.

https://microbit.org

170 questions
4
votes
2 answers

Are there event callbacks in BBC MicroPython?

I am trying to translate the following from Javascript to MicroPython for the micro:bit. This is code example 3 from the inventor's kit translated from block to Javascript. let light_state = 0 # how do you do this…
cup
  • 7,589
  • 4
  • 19
  • 42
4
votes
4 answers

Micro:bit Bluetooth Low Energy Hacking Persistence (High School Internship Project)

My project is to create an interactive program using the Micro:bit microprocessor I'm building a game which uses a drill motor as a controller of sorts reading the rotation direction and speed as inputs for control but my mentor also said it would…
3
votes
4 answers

Is it possible to compile microbit python code locally?

I am running Ubuntu 22.04 with xorg. I need to find a way to compile microbit python code locally to a firmware hex file. Firstly, I followed the guide here https://microbit-micropython.readthedocs.io/en/latest/devguide/flashfirmware.html. After a…
sean teo
  • 57
  • 6
3
votes
1 answer

How to write tests for micropython

I would like to write tests for the micropython code I am writing for the micro:bit. The examples here use doctest. I am open to work arounds for any testing system. Working python example called testing_python.py: def sum(a, b): ''' >>>…
Oppy
  • 2,662
  • 16
  • 22
3
votes
1 answer

Ada for I2C on the BBC Micro:Bit with the MCP23017

I am trying to set up a very simple example using the ada I2C library with the MCP23017 IO expander on the micro:bit (V1.5) but I can't figure it out. For now, all I want to do is turn on an LED that is connected to a GPIOA pin. I have it working in…
toella
  • 55
  • 4
3
votes
0 answers

How to find how much RAM memory is used on my micro:bit using makecode?

I wrote code for my micro:bit in makecode.microbit.org. Idea is to use radio communication and send each micro:bit message. So my question at first was how many messages can get just one micro:bit? Internet say this: Messages received are read from…
josf
  • 3
  • 9
3
votes
1 answer

How do I transfer my Python script including my module to the micro:bit?

We use the micro:bit with the accessory Bit:bot XL. I have a module (robot.py) with just a single function for the Bit:bot (for now). In my script (my.py) I import this function. But after flashing the micro:bit (uflash my.py), there's an error on…
3
votes
2 answers

Failed to connect to socket /opt/local/var/run/dbus/system_bus_socket: No such file or directory

I was trying to send message to the microbit using Bluezero I am using macOS, but got and error. Sample code. from bluezero import microbit ubit = microbit.Microbit(adapter_addr='x', device_addr='x', …
shineila5
  • 31
  • 1
  • 1
  • 2
3
votes
3 answers

Ada i2c demo on the microbit with the Ada Drivers Library?

Overview: I'm trying to program a microbit with Ada using the Ada Drivers Library and I can't understand how to use the i2c functions to establish communications with another chip. I'd like to establish a simple demo so I can understand what's…
Blaine Osepchuk
  • 1,067
  • 1
  • 9
  • 17
3
votes
1 answer

Why does this code display 'A' on start without any input?

This is a morse code translator for microbit but it displays 'A' on start from microbit import * morse={'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L',…
YEp d
  • 154
  • 1
  • 9
3
votes
3 answers

Random number generator for Ada on BBC MicroBit

Working on a little game for the BBC Microbit. with Ada.Numerics.Discrete_Random reports "Ada.Numerics" is not a predefined library unit. Does Ada provide another way to generate random numbers on the BBC MicroBit? …
Glen Flint
  • 31
  • 2
3
votes
1 answer

Why is my microbit showing this animation?

I'm running micropython on a bbc microbit. My microbit isn't running the program flashed to it, it's displaying 0, 5, 0, SAD_FACE What does that animation mean?
phil
  • 561
  • 3
  • 10
3
votes
1 answer

Button B on micro:bit always pushed

I’m programming a micro:bit (in Ada) at the bare-metal level, that is, I’m addressing the nrf51 registers directly. I have no trouble with button A, GPIO pin 17: it’s configured as dir => input, input => connect, pull => pullup, drive => s0s1,…
Simon Wright
  • 25,108
  • 2
  • 35
  • 62
3
votes
2 answers

microbit compass in micropython

I have a microbit project where the microbit is inserted into a kiktronics robot vertically. I would like to get the heading of the robot, but the compass.heading() only works if the microbit is horizontal. I have tried reading the x,y,z…
mksteve
  • 12,614
  • 3
  • 28
  • 50
3
votes
0 answers

micro:bit how to calculate pitch in range -Pi to Pi

How can I calculate the pitch of a micro bit accelerometer as a full range, i.e. from -Pi to Pi radians (the same as -180 to 180 degrees)? Here is my existing micro python code: while True: x = accelerometer.get_x()/1024 y =…
AndyS
  • 725
  • 7
  • 17
1
2 3
11 12