Тёмный

micro:bit Project Joystick with LED Position Feedback Tutorial Ideas 

Electronics Loop
Подписаться 819
Просмотров 10 тыс.
50% 1

micro:bit Project Joystick with LED Position Feedback Tutorial
This is a very easy project.
Hello Microbit Friends
Welcome to another microbit tutorial, today we are connecting a 2 axis joystick to our microbit.
makecode download here: makecode.microbit.org/88588-6...
We’re going to show you how to wire it up and the code needed to move a dot on the led display in response to joystick movement.
Lets get started.
The joystick we’re using is from an electronics kit, it’s the same style as used in games controllers such as xbox.
To make connection easy we’re using an expansion board with our microbit which brings us to our first discussion point on connections.
We want to use the led display to feedback joystick position so we cannot use any pins that are needed to drive the led display. When we press the joystick down activating the button we want the buzzer to sound so that rules out P0 as well.
The joystick has 5 connections, 0v, 5v, VRx, VRy, and SW. Working through these, connect 0v, then 5v. VRx and VRy are the potentiometer outputs, we cannot use P0 as we’ll be using that for the Buzzer, so we will connect VRx to P1 and VRy to P2. Our final connection is for the switch, the next single use pin is P8 so that is where we will connect SW.
Lets move onto the code needed.
First we’ll deal with the switch connected to P8.
We need a pull up on this input pin so we will add that in the startup code. If you don’t have this activated then you’ll not read the input correctly.
We want to continuously read the switch state on P8 if the button is pressed we’ll play a sound so this code will go in the forever loop.
Now to deal with the analogue inputs from the joystick. We want to move a dot across the display to match the joystick movement.
We will use a plot x y block for this. The analogue input values will range from 0 to 1023 and we want to map this to the display coordinates, 0 to 4.
We’ll download the code and test it out.
We hope you enjoyed this tutorial video, please subscribe and tick the notification bell so you’ll not miss our next upload.
Comment down below what microbit project you would like to see us make next.
This video shows you how to connect a joystick to your micro:bit and is presented as an easy project tutorial idea.

Опубликовано:

 

6 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 21   
@ElectronicsLoop
@ElectronicsLoop 4 года назад
Comment down below what micro:bit projects you would like to see us make next.
@julianvanderwee547
@julianvanderwee547 2 года назад
thanks man
@ElectronicsLoop
@ElectronicsLoop 2 года назад
🙌 Pleased you found the video useful.
@julianvanderwee547
@julianvanderwee547 2 года назад
now i can continue with my project🥳
@adriatuz
@adriatuz Год назад
Is there any way for me to detect the led poisition, i have tried to do it in many different ways, but it somehow doesnt work.
@I_am_jake1104
@I_am_jake1104 2 года назад
It's work!
@ElectronicsLoop
@ElectronicsLoop 2 года назад
Glad you found the video useful
@I_am_jake1104
@I_am_jake1104 2 года назад
​@@ElectronicsLoop But my micro:bit lights up x:1, y:2 when I don't move the xy joystick (I'm korean
@ElectronicsLoop
@ElectronicsLoop 2 года назад
@@I_am_jake1104 each analogue value can be different between joysticks due to component tolerances. If the dot moves when you move your joystick then adjust the 'from' values in the analogue read block. This will effectively calibrate the code values for your specific joystick.
@I_am_jake1104
@I_am_jake1104 2 года назад
@@ElectronicsLoop thank
@_quite.essentiallyjay
@_quite.essentiallyjay 3 года назад
i have a gpio extension board, i don't know if that is the problem
@ElectronicsLoop
@ElectronicsLoop 3 года назад
check for pull up / pull down settings and also for connection to +5/GND. We were using an io board. Fingers crossed :)
@thenotsomebody
@thenotsomebody 4 года назад
Can you make a snake game?
@blueyc4rter
@blueyc4rter 2 года назад
I thought the Microbit only went up to 3 volts?
@ElectronicsLoop
@ElectronicsLoop 2 года назад
The expansion board is powered via micro usb hence the 5v supply. It would also work without the expansion board running on native 3v 2xAAA batteries with direct connection to the microbit
@blueyc4rter
@blueyc4rter 2 года назад
@@ElectronicsLoop thanks, I will try it with the aaa's.
@_quite.essentiallyjay
@_quite.essentiallyjay 3 года назад
it didnt work
@ElectronicsLoop
@ElectronicsLoop 3 года назад
awwww no :/
@_quite.essentiallyjay
@_quite.essentiallyjay 3 года назад
@@andrewwallus4384 thanks
@andrewwallus4384
@andrewwallus4384 3 года назад
@@_quite.essentiallyjay quite welcome...hope that helps:)
@ElectronicsLoop
@ElectronicsLoop 3 года назад
@@andrewwallus4384 see the code; clear screen issued before the plot so the screen never fills.
Далее
Connecting an LED to the microbit.
9:21
Просмотров 8 тыс.
PIR-sensor and Micro:bit
14:52
Просмотров 6 тыс.
Cheap and Easy to Use ESP32 Screen!
8:21
Просмотров 128 тыс.
The BBC micro:bit - 10 GAMES
5:23
Просмотров 25 тыс.
Episode 8 - Piano med micro:bit!
8:41
Просмотров 27 тыс.