brian_reiter
Posts: 35
Joined: Fri Jan 06, 2012 7:49 am
Contact: Website

Re: PiBasic

Thu Apr 26, 2012 8:30 am

Gordon's BASIC is quite good, I nabbed a copy a couole of week or so back. Another potential for real ease of use is something like the DuinoMite Mega, its has direct support for the pins etc. embedded in the BASIC.

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: PiBasic

Thu Apr 26, 2012 8:48 am

MadMan said:


OK everyone - laugh at me BUT

Installed Python

Maybe I have been doing PHP too long but it is not quite as intuitive as I would have liked - maybe the light will come on with some use.

For my robot controller the actual "thinking" code should not be too hard to do.

Then of course getting it to "talk" to the GPIO pins as required would be easy judging from what others have said. All I need to do there is BUY some h-bridges and connect them up to the motors and connect the micro switches using opto isolators.


I'd start with LEDs myself... In-fact that's what I'm doing - just built up some LEDs & resistors on my breadboard and now hunting for a suitable bit of cabling to connect to Pi to the breadboard...


I have had a look through the help document supplied with the install but the only "cls" (clear screen) equivalent I found was in the turtle module.


I think (and this is just from what I've read/heard) that you might want to look at the PyGame extensions - these use the SDL libraries - like Turtle (AIUI)


Also, there does not seem to be a way to position a string at a defined place on the screen.

I normally like to have a screen where I can monitor what is going on where - for example, the robot controller would have displays for which motors are on, what direction, when the last trigger on each sensor was detected, the actual run clock and such.

Don't they exist outside the turtle module or am I just not looking for the correct command - if so, what should I be looking for?

GordonH's basic is really starting to look very good if these sorts of commands are not "native" - he must have developed them ;>}


I did - the "hard" way. I decided that I wanted graphics from the start and the SDL libraries seemed to fit the bill - it essentially gives you an olde-fashioned lump of memory that you poke pixels at. So the draw a character, I had to define my own font (actually, I used one of the standard Linux ones!) and poke it to the screen pixel by pixel - at the location specified. I already had a lot of code to re-use as I've done the same on some embedded projects with pixel addressable OLED displays, so it wasn't that much. Lines, circles, etc. are all fairly standard after that, although I did add in a "low res" graphics thing which makes each pixel 8x8..


Anyway, have a good day everyone.


It's raining... And we have a hosepipe ban. Ah the joys of England!

Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: PiBasic

Thu Apr 26, 2012 8:57 am

brian_reiter said:


Gordon's BASIC is quite good, I nabbed a copy a couole of week or so back. Another potential for real ease of use is something like the DuinoMite Mega, its has direct support for the pins etc. embedded in the BASIC.



Hm. That's a nifty little system!

If I have time today, I'll be putting in support for the Pi's GPIO pins into RTB. I already have arduino "wiring" like instructions (maybe not in the copy you have if it's a few weeks old!) to talk to an Ardunio, so my aim is something like:

gpio = DrcOpen ("GPIO:")

PinMode (gpio,0,1) // Pin 0 -> Output

PinMode (gpio,1,0) // Pin 1 -> Input

DigitalWrite (gpio,0,1) // Pin 0

x = DigitalRead (gpio, 1) // Read pin 1

I already have that for the Arduino [x = DrcOpen ("/dev/ttyUSB0")] with hooks to add in an abstraction layer, so I know that if you open an Arduino or the GPIO, it does the right thing internally. (So you can talk to both at the same time - it's already possible to talk to up to 8 Arduinos via USB serial)

Hoping to demo at http://ucubed.info/ on Saturday in you can get over!

Gordon
--
Gordons projects: https://projects.drogon.net/

Return to “Staffroom, classroom and projects”