Mu

Mu is a simple Pynhỏ editor for beginner programmers. With the tư vấn of Mu, you can write Pybé and Micro Pyeo hẹp code in the editor to control the Halocode và other electronic modules.

You watching: Mu

In addition to lớn the basic features of Mu, this version supports more features. Like firmware nâng cấp, code uploading, online debugging through the REPL controller, and real-time viewing of variables and sensor values through plotter.

Preparation Before Use

Visit the trang web below to download the lakiểm tra version of Mu & firmware of Halocode from GitHub:https://github.com/FFtust/mu/releases/tag/V0.0.1

*
Unzip the tệp tin mu-editor.rar after downloading.
*

Quick Start Guide

After installation, the programming learning journey will begin!

1、Connect Halocode lớn your computer

Connect Halocode lớn your computer via the Micro USB cable.

*
Note: You can also connect Halocode lớn your computer via hanggiasoc.vn Công nghệ Bluetooth dongle.

2、Open the Software

xuất hiện the unzipped folder mu-editor, then double-cliông chồng on the the tệp tin .main.exe khổng lồ open Mu.

*

3、Select Mode

From the pop-up Select Mode page, select hanggiasoc.vn Halocode and click OK.

*

Note:You can also click Mode to select mode.

4、Update the Firmware

Before using the Mu editor, you need khổng lồ use the lathử nghiệm Halocode firmware that we haven't released yet. Click Firmware & select the file firefly_firmware_25_01_004-ht1.bin from the pop-up dialog box. Then you can check the tăng cấp progress in the lower left corner of the software.

*
*

5、Start Programming

Now let's complete a programming task! Try lớn make the LEDs on the Halocode turn green. Here is the sample code:

import halohalo.led.show_all(0, 255, 0)Note:Please refer khổng lồ Pybé nhỏ API Reference khổng lồ learn more about the function instructions.

6、Upload Your Program khổng lồ the Halocode

Clichồng Uploading to lớn upload your program lớn the Halocode, then check if the LEDs turn green?

*
*

More Features: Use the REPL Platsize khổng lồ Debug the Program

Reporting information

You can use the print() function in your program as long as the Halocode is connected khổng lồ your computer (via the Micro USB cable or Makebloông xã Bluetooth dongle).Then check the real-time returns of print() in the REPL platsize.

Here is a simple, write code as shown below & upload it lớn the Halocode, then cliông chồng REPL platform and kiểm tra the changes of microphone values in the platsize.

import halowhile True: print(halo.microphone.get_loudness("maximum"))

*

Sending a Command

You can also use the platkhung to lớn debug the program in real time.

Here is a simple, write code in the platkhung and press the enter key, now check if the LEDs of Halocode turn red?

*
You can also continue khổng lồ skết thúc commands to lớn check the loudness detected by the microphone:
*

More Features: Plotter

Chechồng the variable values in real time

The plotter can draw variable values or sensor output values into lớn a graph to lớn make it easier lớn check the changes of the values.

Here is a simple, write code as shown below and upload it lớn the Halocode, click Plotter lớn kiểm tra the value of microphone in real time.

import halowhile True: halo.print_plot(halo.microphone.get_loudness()) time.sleep(0.1)

*

Note:When you connect Halocode lớn the computer via Makebloông xã Công nghệ Bluetooth dongle, the plotter may have some delays due to lớn the limit of Bluetooth communication speed.

Chechồng changes of multiple variables simultaneously

The plotter supports checking the changes of multiple variables simultaneously.

Here is a simple, write code as shown below & upload it khổng lồ the Halocode, then click Plotter lớn check the changes of loudness and i%100.

import haloi=1while True: halo.print_plot(halo.microphone.get_loudness(),i%100) i=i+1 time.sleep(0.1)

*

More Documentation

Basic documentation

If you want khổng lồ implement more features of Halocode và its extension modules in Mu, please refer to lớn Pyhẹp API Reference.

Note: We are simplifying our APIs to improve the user experience. (API is too long to lớn use!) It will be expected khổng lồ be completed in August. We will keep the current APIs as possible as we can though some changes will take place.

If you are not familiar with Pyeo hẹp APIs of Halocode, please refer khổng lồ Convert Blocks to lớn Pythuôn Code.

Advanced documentation

The Halocode has powerful performance & networking capabilities, và we provide some sophisticated APIs for you, so you can build exciting hardware projects with the Halocode và its associated electronic modules, & learn from such things as network communication, IoT applications, APP development, etc. But be aware that these features are often more difficult to lớn navigate.

The Halocode has powerful performance and networking capabilities, and we provide some sophisticated APIs for you, so you can build exciting hardware projects with the Halocode and its associated electronic modules, and learn from such things as network communication, IoT applications, APPhường. development, etc. But be aware that these features are often more difficult to lớn navigate.

network

Micropython thả has implemented a network module và provides the corresponding documentation, which can be found at the following link:http://hanggiasoc.vn.micropybé nhỏ.org/en/latest/library/network.html

Using the APIs in the network will help you make fully use of the Halocode networking capabilities.

network2

Using the APIs in the network will help you make fully use of the Halocode networking capabilities.

Default config:

DEFAULT_AP_IP. = "192.168.4.1"DEFAULT_STA_IP.. = "192.168.4.2"DEFAULT_NETMARK = "255.255.255.0"DEFAULT_GATEWAY = "192.168.1.1"DEFAULT_DNS = "172.16.50.20"DEFAULT_AUTHMODE = AUTH_WPA2_PSKDEFAULT_PORT = 5050API Reference

network2.config_ap(ssid, password)Set the Halocode as an APhường.

See more: Số Điện Thoại Lạ Gửi Verification Code Là Gì, Google Verification Code Là Gì, Verify Là Gì

Note: The Halocode can not be APhường & STA at the same time currently.

Parameters:ssid (str) – wifi ssidpassword(str) – wifi password
Returns:None

config_sta(ssid, password)Set the Halocode as an STA.

Note: The Halocode can not be AP. và STA at the same time currently.

Parameters:ssid (str) – wifi ssidpassword(str) – wifi password
Returns:None

is_connected()Cheông chồng first whether the Halocode is connected to other devices through WIFI. The API is effective sầu when the Halocode functions as an AP or STA. Therefore, you can always obtain the connection status of the Halocode through this API.

Returns:None

set_ip(ip)Set the IPhường address of the Halocode. The Halocode has a default IPhường address before using this API.DEFAULT_AP_IPhường = "192.168.4.1"DEFAULT_STA_IP = "192.168.4.2"

Parameters:ip (str) – ipv4
Returns:None

get_ip()Gain Halocode own IP address.

Returns: ipv4

set_subnet_mark(mark)Set Halocode subnet mask.

Parameters:mark (str) – wifi mark, 255.255.255.0 as defualt
Returns:None

get_subnet_mark()Get Halocode subnet mask.

set_gateway(gw)Get Halocode subnet mask.

Parameters: gateway (str) –
Returns:None

get_gateway()Get Halocode gateway.

create_client()Set Halocode as a client.

client_connect_to(ip_khổng lồ, port = DEFAULT_PORT)Connect the Halocode to lớn the VPS with the specified IPhường address & port.

create_server(port = DEFAULT_PORT)Set Halocode as a hệ thống.

server_wait_connection(port = DEFAULT_PORT)This API blocks the thread until a client connects khổng lồ the server via a specific port, which returns information about the client.

server_get_connections(port = DEFAULT_PORT)Get the IP addresses of all connected clients in danh sách format.

server_get_latest_connection(port = DEFAULT_PORT)Get the IPhường address of the client that was last connected.

write(data, mode, ip_to lớn, port = DEFAULT_PORT)Sover data.

write_line(data, mode, ip_khổng lồ, port = DEFAULT_PORT)Skết thúc data line.

read(mode, ip_from, port = DEFAULT_PORT)Accept data.

read_line(mode, ip_from, port = DEFAULT_PORT)Accept data line.

communication

We have developed the serial communication interface of the Ring Board, so that you can use these interfaces with a variety of hardware with serial communication capability (such as Raspberry Pie, some camera modules) .

*

disable_channel_default(channel)The Halocode communicates with its electronic module through the hardware serial port. The specific communication protocol is used between the two. If the communication protocol is lớn be closed, the serial port command of the optical ring board can be “customized”. Please use this instruction.

Parameters: channel (str) – “uart1/ble”
Returns:None

enable_channel_default(channel)The Halocode communicates with its electronic module through the hardware serial port. A specific communication protocol is used between the two. To restore the communication commvà, use this command.

Parameters: channel (str) – “uart1/ble”
Returns:None

read(channel)Read data through a specific channel.

See more: Cá»­U ÂM Chã¢N Kinh 2 - Download Cửu Dương Thần Công

Parameters: channel (str) – “uart1/ble”
Returns:bytearray

send(channel, data)Sover data through the set channel.

Parameters: channel (str) – “uart1/ble”data (bytearray) – the data lớn send
Returns:bytearray


Chuyên mục: giftcode