Coder Social home page Coder Social logo

Comments (17)

MrYsLab avatar MrYsLab commented on August 30, 2024 1

Because this is a OneGPIO effort, moving to Scratch should be straight forward. I would only need to create the browser side of things. The Tkinter GUI will allow me to test everything beforehand.

The Scratch extension would be similar to thie one I did for the RPi

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024 1

Thanks. At this point, I am not sure if it would be easier in Scratch or Tkinter. TheTkinter GUI builder has some challenges so I started to modify the existing Arduino Scratch extension I published a while ago. I probably should first get pymata_rh working as a python-banyan component. Without that the choice of GUI doesn't matter.
I don't know if you have done any Tkinter programming. It is pretty straight forward with the exception of getting the layouts correct. It usually takes me 3 times as long to layout the widgets so they look correct then it does to get the logic working. If the GUI builder will do the layout for me that would be a big plus.
The Scratch extensions have one annoying issue and that is providing translations for the block text. For my other extensions, users have contributed translations. Since I will be reusing some of the Arduino blocks, I will keep those translations, but for the new blocks, they initially will be in English. This may encourage users to provide translations for the new blocks. This is probably going to be an adventure.
I will be publishing the updated FirmataExpress software in the next day or two so that it can be downloaded using the Arduino IDE library tool. I will let you know when that is available.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024 1

I have a 5 part series on building the extensions if you would like to take a look. I found this article extremely helpful in getting things going.

from pymata_rh.

wallarug avatar wallarug commented on August 30, 2024

That's cool!

I have seen some of these in action before. They are very useful.

I am interested in the Scratch Support that you mentioned before. I was originally looking at scratch support but then abandoned it in favor of MakeCode.

from pymata_rh.

wallarug avatar wallarug commented on August 30, 2024

Let me know if you need any input from me on this one.

from pymata_rh.

wallarug avatar wallarug commented on August 30, 2024

Thanks Alan.

I'm interested in learning about how the scratch backend works. It's kind of the last one I haven't explored yet. That's why I asked.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

The GUI Builder tool, called Page is fantastic! Below is a screenshot of the first screen. This screen sets the digital output modes for all 8 Servo pins. The user will select the mode for the pin and then select the value using the slider. The range within the slider will be dynamically changed depending upon the mode selected.

The tool generated all the code to visually create the page and it also generated stubs for all events. All this within an hour's time.

The documentation for Page is quite extensive and worth the read. The tool is really is easy to use.

I will keep updating here as I make progress.

Screenshot from 2020-08-22 15-45-40

from pymata_rh.

wallarug avatar wallarug commented on August 30, 2024

Amazing!

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

If you would like to see all the tabs populated with widgets, please download
pymata_rh.py
and
pymata_support.py.

To run, place both files in the same directory and type:

python3 pymata_rh.py

Please note that I have not implemented the code for GUI events yet, but all the stubs are in place.
The 2 files were generated by Page. The pymata_rh.py contains all the code to generate the GUI, and pymata_rh_support.py contains all the stubs for the events.

I have tested on Linux, RPi, and Windows (but for some reason looks a little weird), and should work with macOS.

I am really impressed with Page. I generated the entire GUI in about 4 hours. My guess is it would have taken a minimum of a week if I used the Grid or Pack managers to get things looking as good as they do with Page. In addition, I did not have to write a line of code. Page generated the code and it is actually human-readable. Usually, code generation tools generate code that is horrible to read.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

I just implemented dynamically setting the range of the digital input slider widgets depending upon mode selected:
digital: 0 to 1
PWM 0 to 255
Servo 0 to 180

Please note soon I am going to associate the GUI with python banyan. When I have uploaded the banyan enabled code, to run the GUI, you will need to have python-banyan installed on your computer, then start the backplane before starting the GUI.
I will be using the banyan monitor utility so that I can check out the messaging. I will be updating the pymata_rh gateway to add the features not supported for the Scratch extension, namely DHT and Sonar (HC-SR04). Things are going to be in flux for several days, so please bear with me.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

I have now made the GUI a python-banyan component. That means that there needs to be a running banyan backplane to start the GUI.

I tested turning the LED on and off using the GUI and it works!.

If you wish to play with this, again, you will need to

  1. Grab the following files from the gui branch of this repo:
    pymata_rh.py
    pymata_rh_support.py
    robohat_gateway.py
  2. Make sure that you have installed python-banyan.
  3. This is assuming that everything is running on one computer:
    a. Open a terminal and type: backplane
    b. Open another terminal and type: python3 robohat_gateway.py
    c. Open a third terminal and start the gui that you downloaded in step 1. python3 pymata_rh.py

Now if you go to the second tab and at the bottom of the screen select digital out for the LED and then click the slider at the right, and the LED should go on. Click the slider again, and it should go off.

I will be making changes as I test all the GPIO modes, so things may or may not work as I go along. If you are testing and find a problem, please let me know.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

Tabs 1 and 2 of the GUI tested and passed. The code was committed to the repository. On to tab 3 - digital and analog input.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

Digital Input, Digital Pull-up input and analog input tested and passed.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

MPU9250 tab tested and passed.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

INA219 tab tested and passed.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

Both DHT and HC-SR04 have been implemented tested. Next steps:

  1. Clean up code.
  2. Implement a launcher that will invoke the backplane, the gateway and the GUI from a single command line command.
  3. Update the documentation.
  4. Merge back into the main branch and release.

from pymata_rh.

MrYsLab avatar MrYsLab commented on August 30, 2024

I've just released version 1.1. It incorporates the gui demo and launcher that will launch both the GUI and robohat gateway.
To upgrade:
pip install pymata-rh --upgrade

To run the GUI after installing, open a command window and type: rhdemo
The GUI will open and the gateway will start in about 5 seconds. Here is what you should see in your command window:

$ rhdemo
backplane started
GUI Started
RoboHAT Gateway started.
Please wait 0 seconds for Robohat to initialize...
RoboHAT is initialized.
To exit this program, press Control-c

from pymata_rh.

Related Issues (7)

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.