GithubHelp home page GithubHelp logo

bipes / bipes Goto Github PK

View Code? Open in Web Editor NEW
134.0 134.0 62.0 17.57 MB

BIPES: Block based Integrated Platform for Embedded Systems allows text and block based programming for several types of embedded systems and Internet of Things modules using MicroPython, CircuitPython, Python or Snek. You can connect, program, debug and monitor several types of boards using network, USB or Bluetooth. No software install needed!

Home Page: https://bipes.net.br/ide

License: GNU General Public License v3.0

JavaScript 93.29% HTML 0.68% CSS 0.55% Makefile 0.03% Shell 0.08% Python 5.29% PHP 0.08%
arduino block blockly embedded embedded-systems esp32 esp8266 iot micropython programming web

bipes's Introduction

BIPES: Block based Integrated Platform for Embedded Systems.

BIPES

BIPES allows anyone to quickly and reliably design, program, build, deploy and test embedded systems and IOT devices and applications. It is fully based on a web environment, so absolutely no software install is needed on the client / developer machine.

More information at the project website: bipes.net.br.

Live version

Try it now at: bipes.net.br/ide.

Usage

To init submodules, like BIPES/freeboard and BIPES/Databoard, run:

make submodules

To build/update the offline version with latest, run:

make offline

This version does not require a server since it has all core files concatanated at ui/index_offline.html, just open this file in a browser. It will also create a bipes_offline.zip. Howver, keep in mind that any tool that requires a server, like MQTT, won't work due to CORS.

That's it, enjoy BIPES ๐Ÿ˜„.

Documentation

The documentation is online at bipes.net.br/docs.

To build the documentation out of a fresh clone, do:

make doc

after having installed the theme, sphinx and sphinx-js.

pip install sphinx sphinx-js furo

More information

Some functions of ui/index.html were based on Blopy project (https://github.com/mnoriaki/Blopy), by Noriaki Mitsunaga (https://github.com/mnoriaki).

OpenCV blocks were automatically generated using berak's OpenCV to Blockly generator (https://github.com/berak/blockly-cv2/tree/master/gen).

We also use xterm.js (https://github.com/xtermjs/xterm.js/) and codemirror.js (https://github.com/codemirror/codemirror).

bipes's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bipes's Issues

Button to share program by link stopped working

Share button by link stopped working on the last code refactoring. Console shows the following error:

Uncaught ReferenceError: BIPES is not defined
at Object.BlocklyStorage.link (storage.js:70)
at HTMLButtonElement. (code.js:473)
BlocklyStorage.link @ storage.js:70
(anonymous) @ code.js:473

Feature request - Time Formatted from RTC list to text

I have created a library feature that works nicely with the following functions for the ESP32:

  1. Date_Format generates a line of text such as 'Thur 26 Jun 2021' from the RTC list
  2. Time_Format generates a line of text such as '6:00:34am' from the RTC list
  3. Center_Text that provides the starting position of a text string to centralize the text on the display, when given display width and the string
  4. Right_Text that provides the starting position of a text string to right adjust the text on the display, when given display width and the string
  5. Left_text (returns 0 to position at the start left-hand side of the display)

Hard to debug now the Code tab is gone

Are for debug of code is needed to understand why blocks aren't working without loading the code on the device.

Eg. why is the Init ST7789 block not working? I'd understand better if I could see the micropython code being used.

PWM duty tool

Can you possibly do a PWM duty tool to adjust the duty of the existing pwm? Possibly a pwm frquency tool might also come in handy.

To produce a code such as:

pwm4.duty(0)

Init ST7789 block is not working

I wrote the code to my device and it seems the Init ST7789 block is not connected to block yet.

eg. The block says I2C with SCL=5, and SCD=4, but the code generated (as it should be) is generated for SPI protocol.
Please update the Init ST7789 block so it represents the SPI connections with SCK, MOSI, Reset, CS, DC.

=== import machine
=== import st7789py
=== 
=== 
=== # turn on backlight
=== bl = machine.Pin(4, machine.Pin.OUT)
=== bl.value(1)
=== spi = machine.SPI(1, baudrate=20000000, polarity=1, phase=1, sck=machine.Pin(18), mosi=machine.Pin(19))
=== display7789 = st7789py.ST7789(spi, 135, 240, reset=machine.Pin(23, machine.Pin.OUT), cs=machine.Pin(5, machine.Pin.OUT), dc=machine.Pin(16, machine.Pin.OUT))
=== display7789.init()
=== display7789.fill(st7789py.color565(40, 40, 1))

utime doesn't exist for Snek, but time does

The module utime doesn't exist for Snek, but time does. That means that delay in BIBES doesn't work with Snek. For Microbit time is an alias for utime, so it might be possible to change to time for all boards.

"to item append text" could use +=

to item append text n could use item += n instead of item = item + n as it does now. This would make the code smaller which is useful for Snek. Snek also does not support the Python of create text with and therefore one has to use to item append text very much. Also Snek does not support str(), so you have to remove unnecessary str() and replace necessary with your own function that contains "%g"%n. If you use += there are less str() to remove. It would be good if unnecessary str() was never inserted, but that is perhaps too difficult to solve. Perhaps also create text with could be changed so that it works with Snek.

NeoPixel need an np.write() block and please remove np.write() function from the NeoPixel block

The NeoPixel block is great fun, but it seems to send a lot of data because the np.write() is called every time the Neopixel block sets one LED color.

So with 32 LEDs, it sends out 32 times more data than it needs to, because you should be able to set the whole list of 32 LED colors and call the np.write() function just once.

Can you possibly create one more block for the NeoPixel and modify two that you already have?

1st block is new
np.write()

2nd and 3rd blocks to remove the function call np.write()
Currently:

np[0]=((255,0,0))
np.write()

Preffered:
np[0]=((255,0,0))

Feature request - import neopixel - and custom Neopixel Display block

Neopixel (ws2812) LED RGB strip lights protocol is already included in micropython for multicolored displays.

Example user code:

import machine, neopixel
np = neopixel.NeoPixel(machine.Pin(19), 16)

np[0] = (255, 0, 0) # set LED 0 to red, full brightness
np[1] = (0, 128, 0) # set LED 1 to green, half brightness
np[2] = (0, 0, 64) # set LED 2 to blue, quarter brightness

These could be easily configured with three blocks

  • Neopixel init block to define the pin and number of LEDs, and Name of the Neopixel to produce the following code:

import machine, neopixel
np = neopixel.NeoPixel(machine.Pin(19), 16)

  • Neopixel block that selects the name of the Init and then has horizontal space for a number of variables to produce the code for as many variables are loaded into the block and according to their position. eg, a variable Color0 in position 2 (of 16) would only produce the following code:

np[1] = Color0

  • Color block to produce a single tuple variable with (3 numbers) for example ** Color0 = (R, G, B)**. This block has a round circle to display a single color as selected from a color lookup chart. These Colour blocks can be copied and placed like other variable blocks. By themselves, they would generate code for example a red LED on half brightness:
  • Color0 = (128, 0, 0)
  • copying Color blocks doesn't always create new variables, until the color is changed

If you need more thoughts about this let me know.

Python code fails to generate when NeoPixel color is set with a variable - please fix ASAP

I think the variables used to work with the NeoPixel, but now it doesn't.

image

From the image, everything works normally until the variable is placed in the 'color' block.
The python code fails to generate.

As you can see, the variable I set is a number, and as the number 123 is within the 0-255 required value, it should be acceptable within the color block. But it fails to generate any python code as soon as this variable is applied in either of the three variable locations.

Can you please fix this ASAP?

Urgent - PWM code not working on ESP32 due to incorrect use of machine.Pin

The code below is generated with the PWM tool which doesn't work due to use of machine.PWM and of machine.Pin.

Resolve by removing both strings 'machine.' at line 4

Corrected code should not use 'machine.' before the function. PWM(... is called. PWM should be called without the preceding 'machine.'
Similarly, 'machine.' should not be included before 'Pin'

1 from machine import Pin
2 from machine import PWM
3
4 pwm14 = machine.PWM(machine.Pin(14))
5
6
7 pwm14.freq(1000)
8 pwm14.duty_u16(50)

Chart labels are "leaking" to others tabs.

Pretty sure changing #content_* rule fromvisibility: hidden; to display:none; will fix.
Also, to make #content_* scrollable, just add overflow-y: auto to ui/style.css (line 192).

(* is the desired tab's id)

Screenshot from 2021-07-05 13-48-24

Ultrasonic Block has an odd connection problem

Esp32 Ultrasonic block has an error with any other block connected after it:
ย 
For example, the following code example works unless the OLED block is connected after the Ultrasonic block.
ย 
Also, can I2C Init have a default value at variable I2C?
Eg. 1
Or -1

image

NeoPixel Color defined simply by Hue and Brightness variables

Hi,

I have generated some code that nicely converts Hue and Bright variables into RGB for the neopixel as shown below:

Can you possibly put this code into a block with the other NeoPixel blocks before Monday?

Example Block Code that returns a RGB formatted list is shown within a print function.
It demonstrates two values representing Hue, and Brightness - both are values from 0 to 255

print( Hue_to_RGB(120, 50) )

Functions to include when the first "Hue to RGB" block is used:

import math

Hue = None
Bright = None

# Describe this function...
def Color(x):
  return (math.cos(((min(max(x, 0), 180) % 180) * 2) / 180.0 * math.pi) - 1) * -0.5 + 0.005

# Describe this function...
def Hue_to_RGB(y, z):
  return ((int((z * Color(y % 256)))),(int((z * Color((y + 85) % 256)))),(int((z * Color((y + 170) % 256)))))

The block could look like this below with two int or variable values ( Hue, and Brightness ). None of the variables need to be global.

image

Copy and Paste between Bipes tabs and versions

Is it possible to copy and paste between browser pages, such as between two online versions in different tabs, or between an online version and an offline version.

This would be very helpful to transfer files easily between tabs, and to also get around the problem of not being able to load files in the offline version.

New RTC method in Timing init produces no code

To get the RTC to initialize with code there is an RTC init tool in the Timing folder to accept 6 numerical values but it produces no code.

It should produce code like the following (and please notice the double brackets):

rtc.init((2021, 6, 28, 0, 8, 40, 0, 0)) # year, month, date, 0, hours, minutes, seconds, 0

OLED display blocks for drawing lines

Hi,

Can you please add some blocks to use the gfx library for the OLED ssd1306?

This following code works for me once the gfx.py file is loaded

from machine import Pin, I2C
import ssd1306
from time import sleep
import gfx

# ESP32 Pin assignment
i2c = I2C(1, scl=Pin(22), sda=Pin(21))

# ESP8266 Pin assignment
#i2c = I2C(-1, scl=Pin(5), sda=Pin(4))

oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)

graphics = gfx.GFX(oled_width, oled_height, oled.pixel)

while True:

  graphics.line(0, 0, 127, 20, 1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.rect(10, 10, 50, 30, 1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.fill_rect(10, 10, 50, 30, 1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.circle(64, 32, 10, 1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.fill_circle(64, 32, 10, 1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.triangle(10,10,55,20,5,40,1)
  oled.show()
  sleep(1)
  oled.fill(0)

  graphics.fill_triangle(10,10,55,20,5,40,1)
  oled.show()
  sleep(1)
  oled.fill(0)

Blocks I suggest to start are:

Line
Rectangle
Triangle
Circle

Rectangle, Triangle, and Circle could each have a filled/outline option

But I'd also like to have blocks to simulate robot motion:
Turtle Turn block and Turtle Move block, although this might be a bit harder to implement.

Phil

code malufunctions on machine. tools with duplicate function name

RTC.now and many other tools generate python scripts with a duplicate function such as RTC.RTC as shown below. This happens for almost all of the 'machine.' tools.

oled.text(('Year = ' + str((machine.RTC.RTC.now()
)[0])), 0, 7)

Also, notice the code goes on to a second line for no reason.

File versioning.

XML files are ridiculously persistent in modern browser, causing a reasonable frustration with updates.
A quick solution would be requesting scripts and data files with a pseudo tag like ?ver=1.1.0.

More robust solutions could be considered, therefore I opened this bug as a thread of discussion for a long term implementation.

NTP fails with a traceback of 3 errors

I'm not sure why, but the NTP doesn't seem to work. I get the following traceback info:

Traceback (most recent call last):
File "", line 6, in
File "ntptime.py", line 34, in settime
File "ntptime.py", line 20, in time
OSError: -202

Fix for bug #47 broke some EasyMQTT functions

The fix for bug #47 seems to have interfered with some EasyMQTT functions. While trying to use EasyMQTT, code is not generated when the subscribe block is used and the console shows this error:

generator_stubs.js:697 Uncaught TypeError: Cannot read property 'getName' of undefined
at Blockly.BlockSvg.Blockly.Python.easymqtt_subscribe (generator_stubs.js:697)
at Blockly.Generator.blockToCode (blockly_compressed.js:902)
at Blockly.Generator.Blockly.Python.scrub_ (python_compressed.js:23)
at Blockly.Generator.blockToCode (blockly_compressed.js:903)
at Blockly.Generator.workspaceToCode (blockly_compressed.js:900)
at Code.generateCode (code.js?ver=0.2.1.8151338:342)

image

Android keyboard opens then immediately closes when input field is selected

Hello,

I'm currently watching this project as I might want to use it to help kids / students learn how to program a Wemos D1 mini using Micropython.

While testing the interface, I noticed a problem with Android devices. When I click on an input field (e.g. the 'Address' and the 'Password' field in the 'Console' tab) that opens the Android keyboard, the keyboard closes again immediately. I tested this with a Samsung Galaxy A50 and a Samsung Galaxy S8. I used the Chrome browser and the integrated Samsung browser. I also activated the desktop mode for testing. It worked with an Apple iPad. My guess is that opening the Android keyboard triggers your resize EventListener, but I don't really have much experience with web programming..
Are only devices with a certain minimum resolution supported?

Anyway, keep up the great work. This project looks very promising!

kids customs code with Python tool could be much easier

It would be of great benefit to younger kids using Bipes custom Python code to use the Pin function instead of the machine.Pin function.

To do this, can you please change the code in the set pin block and importantly it won't upset any of your other pin functions that use gpio_set, and your Read Pin block is already using this from machine import Pin anyway. So it would be consistent to change the Set Pin block to match it also.

from this:

import machine

def gpio_set(pin,value):
  if value >= 1:
    machine.Pin(pin, machine.Pin.OUT).on()
  else:
    machine.Pin(pin, machine.Pin.OUT).off()

to this:

from machine import Pin

def gpio_set(pin,value):
  if value >= 1:
    Pin(pin, Pin.OUT).on()
  else:
    Pin(pin, Pin.OUT).off()

nothing else needs to change here. And with this one change, custom Python blocks will be easier, as the kids can initialise the pins with the set pin block, and have access to using the Pin function instead of the machine.Pin function

Lists have a number minus 1 cause unexpected behaviour

In creating a list of colors for our NeoPixels, I have noticed the Bipes code generates a list number 'minus one' for some odd reason. This is painful to have to teach students a code workaround because of a non-standard implementation of MicroPython in Bipes. We are trying to teach kids how to code in the MicroPython language, but Bipes is making this difficult by injecting non-standard code.

I am clearly getting the list value from a variable called LED and the list does clearly use the values from 0 to 7. Knowing this value in lists starts from 0 is standard MicroPython implementation.

image

But Bipes is clearly introducing a LED minus 1 calculation (as shown below) which I did not instruct it to do.

image

Am I meant to teach my students to do the math to add one to every loop start and finish because Bipes demands it? This is an unnecessary workaround.

Can you please remove the 'minus one' calculation from lists?

In the Get List Block with LED as the variable, it should just say:

[int(LED)]

Small error in Neopixel still for the ESP32

image

  1. Can't connect individual numbers (or variables) into the Neopixel block as it is grayed out.

I suggest this block by default is similar to the one you can attach to it but with three numbers default at 0.

PWM deinit tool

Hi,

It would be great if you could implement a PWM deinit block that allows the user to select from the existing PWM options.

I'm not sure how to do this in code to reference other existing blocks.

But the code is simple.

Eg.

pwm4.deinit()

Of course the user would someone need to select the pwm pin to deinitialize.

I don't have time to work on this though sorry.

Cheers

pwm and pico

I am using a pico and going through some bipes blocks examples, LED blinking works great, but fading with PWM is giving an error (I have uploaded the Raspberry pi code using the bipes console and it works fine). The error using the blocks from https://bipes.net.br/beta2/ui/#7piqwf showing up on the console is:
File "<stdin>", line 11, in <module> AttributeError: 'PWM' object has no attribute 'duty'

WebREPL not connecting over STA anymore

I'm sure I had this working via my phone 5 or so weeks ago, but now WebREPL in Bipes isn't connecting to my ESP32.

I have a solid WiFi connection through my router as I can ping the ESP32 ip address without any problem.

After a successful connection, the ESP32 then runs the following code so it doesn't require any prompt:

import webrepl
webrepl.start(password='xxxx')

Any suggestions as to what I'm doing wrong please?

ADC not working in ESP32, and new tool suggestions for better ADC control

Code generated with ADC pin is wrong
import machine
adc(35)=machine.ADC((35))

Correct code should be:
from machine import ADC, Pin
adc35 = ADC(Pin(35))

Also, please include tools to generate the following lines:

adc.atten(ADC.ATTN_0DB) # options are ATTN_0DB, ATTN_2_5DB, ATTN_6DB, ATTN_11DB
adc.width(ADC.WIDTH_10BIT) # options are WIDTH_9BIT, WIDTH_10BIT, WIDTH_11BIT, WIDTH_12BIT

WebBluetooth files not found - library code error

I just tried to load the library file for WebBluetooth, and the three files downloaded succesfully onto my ESP32 contained the following code:

<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.4.38 (Debian) Server at bipes.net.br Port 80</address>
</body></html>

Unify files among projects

Unify block_definitions.js, generator_stubs.js, and toolboxes among beta2 and beta2serial projects. They are the same files but maintained separately among beta2 and besta2serial.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.