Communicating with Pythons that eat Raspberries

Hello,

My name is Nathan, and I’m here to help build a community. Not today with this post, nor in the coming days as a figurehead to rally ‘our’ cause. I have my own cause to rally for, and every cause needs a community to support its growth: yours or mine.

To achieve the goals of my cause I intend to learn python 3 using Cpython in conjunction with a raspberry Pi 3 (Model B). I’m looking for a way to allow a individual whom suffers with spastic muscle control an reliable way to communicate through hand grip differentials.

To this end I need to create a device that can track input from spastic grips and then categorize said inputs into a useful output capable of controlling a device such as a wheelchair or the creation of a text file.

I’ll be slow to update this forum, so consider this as you would a traditional pen-pal, one that isn’t as into correspondence as yourself.

Cheers, NV!

1 Like

I’m glade that Julian suggested learning Python, and that I listened.

Installing Python proved a simple thing: Googled “official python website”, Clicked the python.org “Download” button (indicating Python(3.6)), clicked another button indicating the same, saved file, then, executed said file, while following prompts.

I’m ruining windows 10; To access my newly installed Python, I need the ‘cmd’ (Command Prompt). I simply searched for “cmd”. Once opened I pined it to my taskbar.

Entering into Python was less effort then writing this sentence. From inside the cmd I typed “python”, then activated my ‘Enter-Key’. To exit Python hold ‘Control-Key’ + ‘Z-Key’ release, then its another ‘Enter-Key’ to reenter cmd proper.

A simple thing really, taking just one small step.

Let me drop a little post-script on yea…

Intro Books Suggestions from: python.org I selected ‘The Python Apprentice’, based on the ‘Book Overview’, as my foray into python(3.6). It’s turned out to be a page-turner.

Intro Site from: python.org I prefer to start any foray with a book, but this site was suggested when I ‘Enter-Key’ “help()” into Python(3.6) for interactive help. Once done with ‘The Python Apprentice’ I intend to review this resource also.

Cheers, NV.

As I stated in the ‘post-script’ of my last post, ‘The Python Apprentice’ has been a page turner (mostly in a non linear fashion). It’s the aspect of revisiting topics that lends to my enjoyment of physical textbooks. That said It isn’t the median that’s important, it’s your approach to learning that is.

Through experimentation I’ve found scheduling fewer and longer, Python sessions is less likely to get me the same results as scheduling more, less lengthy sessions. Consider that each session dose two things. Firstly, when scheduling a task, its far easier to push back one day out of seven then to do so with five days of seven booked. Lastly, when studying any subject, entering into a ‘Flow’ state is ideal. Having more scheduled sessions will improve the odds that any one session transitions into a state of ‘Flow’.

Expressing natural curiosity is perfect for promoting insight and retaining knowledge. When you encounter new ‘Statements’ in Python, experiment! I’ve learned much from Pythons’ ‘SyntaxError’ function. Experimentation also breaks up the monotony of any textbook, preventing you from succumbing to unfocused ‘Mind-Wandering’. Meaning, ‘Mind-Wandering’ isn’t the issue. For instance, while in a ‘Flow’ state you may ‘Mind-Wander’ from the text books intended coarse, that’s fine! As long as it provides useful insight into Python, or towards reaching your goals for learning Python.

The use of goals is a convenient tool to both reward your efforts, and complement your learning. My goal was to print off the results “>>>for a in range(1001):” where the binary: “>>>0b10”, “>>>0b100”, or “>>>0b1000” could be printed for “>>> x=0ba”. —Code on that one.— Every time I encountered a new ‘Statement’ I’d evaluate it’s use towards solving my goal. This would often provide the need to review a few pages back, thus the ‘page turner’. Having a goal also made studying into a puzzle; I found myself propelled by lingering-encouragement from each connected piece. Create/refine a final project to achieve; eventually allowing a sense of a ‘job-well-done’.

Ensure you decided on which style of Python ‘layout’ to employ. For some ‘Python Zen’ “Enter-Key” the following: “>>> import this”. Me, I prefer implicit over explicit in contradiction to ‘Explicit is better than implicit.’. However, I favor implicitly due to my own understanding of ‘Readability counts.’. Remember, If your going to code with others, picking a ‘layout’ style becomes very important. —The wisdom of researching your ‘Audience’, before giving a speech. ~NV!—

Cheers, NV.

Over the last 4 weeks I’ve spent the first 2 placing a wager in the form of a patent request (a topic I’ll touch on over time). Recall that I mentioned in my last post, goals are important towards achieving your objectives; by creating a wager (in the forum of a patent), which only costs 25$ for an unsuccessful application and 200$ for the opposite (initially), was a bet worth taking. The following week I focused on the recruitment of a trusted friend to assist with said patent, and the refinement of the patents ‘how-to’ (a process unconnected with the achieving a patents file date). After which I switched focus back to learning the skills required to achieve said patent this last week.

This was an intermission post as I’ve touched on many areas, each requiring their due time. Check back soon.

Cheers, NV.

Happy Python adventuring!

Here are a few thoughts and ideas:

  • the Python Cookbook can be a great resource when you want to figure out how to achieve a certain, often roughly common, goal
  • I agree re longer sessions for learning code (or math); I’ve never been able to grasp more abstract ideas in short sessions
  • The REPL (Read, Evaluate, Print, Loop) is really nice, and key for quick idea iteration. That’s the key advantage of interpreted languages (eg Python, Javascript, Ruby) vs compiled languages (eg C[#,++], Java, Pascal, Ada). Compiled languages typically have a lot more checking done by the compilation process (text -> instructions for the computer can execute.) Swift is interesting, in that it has been designed to be easily compiled; so quickly in fact that it looks like an interpreted language (Swift playgrounds - https://stackoverflow.com/questions/40593918/how-does-apples-swift-playgrounds-app-for-ipad-execute-code)
  • There are websites that let you play anywhere with REPLs, eg first on a Google search: https://repl.it
  • Use an IDE; you get so much more from the REPL, eg cut and paste into your script, execute, pause, try something, update code, continue. I really like WingIDE. (Disclaimer- I’ve bought their products in the past, and they’ve also given me generous discounts for educational use.)
  • For trying algorithms, especially more mathematical ones, and documenting them, I like the look of http://jupyter.org.
  • For windows 10, you can install the Linux subsystem with Ubuntu, which is similar to Raspbian on the RaspberryPi.
    • may reduce weird bugs from differences between linux and windows versions of Python libraries
    • lets you practice setting things up for a (small) linux computer
  • I won’t get into formatting wars, but will give you this to consider: which is easier to re-read in a couple of years time, or for the first time?
1 Like

To Whom,

Since I’ve last typed into the void I diverted my attention from the inventing of a controller, capable of interpreting actionable outcomes from a user’s spastic movements over time, towards completing a draft-18-pager comic based off the following poem:

https://drive.google.com/open?id=1ZPondzA0mqOoU6UeLzRpjftkWlXrUTKy

Shrouded in the silt of past experience.
I am warmed amongst the stillness of stagnant waters.
An awareness crafted within dissolved sensations.
My gaze fixed upon a scant beam of light.
My star… My world… My reality.
Gatekeeper to all I am, or will be.

~NV

I find that allowing myself the ability to switch focus, while still participating in a creative medium requiring both communication and dedication to accomplish, helps me prevent mental fatigue while honing skills useful to the completion of other endeavour(s).

As I mentioned in my last post, I recruited a friend to help with the creation of the project, including the assembly of the Raspberry Pi and differential-input-controllers while I created the above comic (having already created a trial program that would function as the software, and wanting to avoiding mental fatigue); I have just this week received back the gear I sent off those many months ago.

Though delayed further then I attended, I knew it would be some time till I started back up with the project, as such I created a ‘save file’ of sorts. The following links are appropriated from said save file:

https://docs.google.com/document/d/15shvV1YleXXJrzpofCW2ruU5pMLEfqsoEZWK4Jod4WI/edit?usp=sharing

  • I created the above file as step by step breakdown of the Pilot Program, including notes around issues yet to be resolved.

https://drive.google.com/open?id=1mIPMj11Fw_33-LY5zXFhsi3M9jqmj8GQ

  • The above is a screenshot of the Pilot Program taking in differently user input over time and then through the use of logic gates prints to screen a ‘book-holder-command’ (IE: ~Option_Two_ab~) (expecting it’s actually a screen grab of my first attempts at Python Class’); within the above screenshot is a hidden error in the waiting (yet to be resolved)…

https://drive.google.com/open?id=153Ypzh7F8bdWnvJWiIfIvMK6dz59AuIK11O8f_6DVYw

  • Preceding is a visual break down of my attempts to simplify the incoming inputs in order to simplify my understanding of the program/user-interface development

https://drive.google.com/open?id=1UajrKr-vu7dzgKTbsWJ9SS9wuyVauyM4-uBScmErPi8

  • As for Input ranges the above indicates the areas that can likely produce sufficient/purposeful movements as directed by my client.

https://drive.google.com/open?id=1I4FG-w9plL37jrX8Mig_9FNszO6ecWhRwD4u5aAdUCI

  • This is the start of my next chapter, Python Class creation; hopefully enabling the ability to work within a repeatable process loop, while utilizing multiple client controlled inputs.

I will also be starting the process of assembling my Raspberry Pi and thereafter the running of Python from the Pi, upon which I’ll take differential input over span(s) of time, then recreate results equal to and beyond, the aforementioned Pilot Program (operating with the inclusion of Python Class’).

PS. Thank you Julian for your thoughts and Ideas, I’ve sent off for the Python Cookbook; I was thinking I could benefit from another tome, as I learn well from the medium.

Cheers, NV!

Awesome to see progress @Vonan !

Next time you’re over I’ll have to introduce you to version control (e.g. git, mercurial, or similar). Much easier way of backing up, sharing, and getting comments on code.

Let us know when we can see the comic.

We’re still doing Saturday 2-4pm open houses, but hope to be doing more than that by mid October.

To Whom,

I’ve since set up the Raspberry Pi, upon which I do most of my coding. It’s running Python 3.5.3, and has some legacy aspects installed I could access, but don’t. What I have done has been to focus on implementing the use of classes and how to return and pass data between said classes.

Follows, a personal problem I’ve encountered learning Python; I learn through an evolutionary-like process of trail and error. Though this process dose allow me reasonable results, it is slow and often too isolated towards other methods of structured learning, such as through a programming coarse. This is often most apparent when involving issues around syntax; IE, what is a built-in function versus what is a stand in name-holder when your first starting off? I do enjoy experimental learning, in spite of it’s short comings. I can however overcome some shortcomings by associating with those capable of experienced guidance. It was such guidance that helped me gain the necessary insights towards deciphering difference in programming syntax. Thanks Make it Zone.

I now have seven .py files INPUT_, USER_aa, USER_ab, USER_ac, GATE_, CORE_, ACT_) each it’s own class, though three files are in essence repeats, but for their separate input devices.

The program starts with accessing INPUT_ which then tests to see if the User has inputted a rage above a resting range by calling USER_aa, USER_ab, and USER_ac. If the inputted rage is indeed above a resting range, then that User’s input device is noted (USER_ac takes president), then is sent along to GATE_ were the choice is made as to weather it’s USER_aa_, USER_ab, or USER_ac. Once chosen CORE_ is called and the chosen input is associated with either a light/medium/hard average ranges, returning to GATE_. Finally ACT_ is called; here the average ranges are compared to logic gates, thus potentially activating actionable outcomes. After witch the program restarts at INPUT_.

I will need to code-graft the three differential human interface devices onto all the USER_## files, as well as rewriting the CORE_'s input types/locations. I’ve also ordered more supplies to test inputting data from analog controllers into the Raspberry Pi. Wish me good en devours!

Cheers, NV.

Hi, I just found out about this place and wish I’d known about it a couple of years back when I was playing around somewhat aimlessly with RaspberryPI’s and Arduino’s. I was trying to learn Python with a simple project of using a motion detector to turn on my bathroom under-cabinet led light strip gradually when someone entered the room, then turn off after a few minutes. Simple for many for sure, but it took me a while. Finally got it to work in principle on the bench but that’s where it ended sadly. I would still like to become more capable with Python, but simply for the challenge really.

Hi @bbc0! Glad to see you on our forum!

Will definitely be hosting some python & hardware related projects. In the near future probably esp8266 and c/c++ (to convert some custom rgb LED fixtures to use DMX) but once that is done I’d like to take a look at micropython! Keep an eye out for announcements. Or drop by to get started on something sooner :slight_smile:

3 posts were split to a new topic: Lulzbot Mini Recommisioning