Using Half-Byte Embedded Tiny Basic to Teach

HBPortableLabIt is 2017 and we have a slew of low cost or free tools available that teach anyone how to program a computer.  Just for Windows, we have something called Small Basic, from Microsoft. It is free and has a bunch of material you can use to teach anyone, especially children, how to code. There is also Python, Minecraft and a host of other, modern tools.

So, why use something as crude as Tiny Basic? One that requires a terminal? Well, there are a few reasons you may want to do this.

Cost, for one. 

It is free. It runs on Arduino and Arduino clones.  You can use it to also teach basic electronics.

And, that is what I am doing…using it to teach not only programming, but also how computers work.  It is really more for the latter as Small Basic cannot manipulate sensors and other hardware like Tiny Basic can.  Since Tiny Basic includes instructions for reading temperature sensors and a real time clock, it is perfect for teaching things like turning on something on if the temperature gets above a given number or it if is 5 o’clock, turn off something.

I recently started doing this with my step son.  We used Embedded Tiny Basic on my ‘portable’ lab, which contains an Arduino UNO clone, a 2 x 16 LCD, breadboard and voltmeter.  We first made one green LED blink, then added a second, red LED blink.  I used Tiny Basic to explain how to talk to the LED’s and used the DELAY instruction to make the LED’s blink at a constant interval.  I also took the opportunity to teach him binary.  We had discussed it previously, but I don’t think he really got it. Until now.  Using the DWRITE statement, which takes two parameters…pin number and a zero for off or 1 for on.  Having him use that code got him to understand the concept.  Small steps.

His mind is wandering now…’I can build a robot…a game…something to tell me when Xander is coming down the hall…’ Xander is his four year old brother. 

There are those of you out there who are thinking that this is a terrible idea, using Tiny Basic, that is.  Well, no, not really.  He is getting real instruction with a more object oriented and modern language while using Tiny Basic to learn the nitty gritty of the hardware.  You do not need a modern, object oriented language to blink an LED. 

I will post future updates on our progress as well as sample code.  Below is the code we used to blink the LED’s.

100 PRINT “INTERVAL”;: INPUT I
110 FOR X=1 TO 50
120 DWRITE 3, 1
130 DELAY I
140 DWRITE 3,0
150 DELAY I
160 NEXT X

(For single LED-it was on digital pin 3)

Advertisements

Hello, Samsung! My new journey with Android and Samsung-the Galaxy S8

Long time readers know I am a huge Windows Mobile 10 fan. I’ve had a Windows Phone/Mobile device for nearly four years and, prior to that, I had a Windows Mobile 5 device (a Motorola Q) waaaay back in 2008. Needless to say, I like Microsoft’s mobile operating systems. I had an Android phone in 2011 and then got an iPhone 4 when Sprint started carrying them. I NEVER liked that Android phone or the OS itself. I tended to crash and always told me I had filled up its storage even when there were gigabytes left on the SD card. It was slow too, much slower than my Palm Pre, Moto Q or that iPhone. Android was terrible. I said good bye and that was that.

Well, fast forward a few years and my beloved Windows Mobile 10 is, sadly, being left behind by its own creator. It never caught on with the public or with business, even with the hooks that business wanted. Sadly, it was an iOS and Android world.

Earlier this year, I spent a ton of money on an Alcatel Idol 4s with Windows Mobile 10. It is a fantastic phone, but developed an audio issue…I couldn’t hear phone calls unless on speaker phone. Apps I was using were being abandoned. I decided I needed to byte the bullet and move on. I can still use the phone, as a desktop device due to Continuum. But, what would replace such a capable phone and OS?

I read about Samsung’s Galaxy S7. Seems like a great device. But, then I discovered the S8 was out and was even more capable. So…I got one. Discounting the awful experience I had getting the phone (T-Mobile is far worse, customer service wise, than any other carrier…but, that is another story) the transition from Win Mo 10 to Android Nougat was much easier than I had thought it would be. The first thing I did was to Microsoft my phone. I installed the Arrow launcher, install Office, install Cortana, setup OneDrive, install Bing, set Bing as my default search engine, made sure the fluffy Google crap was off or uninstalled and installed SwiftKey. I tried some of the Win Mo 10 like launchers, but, ultimately, went to Arrow and its more Androidy look. The Win Mo 10 Launchers work well, but, I decided to make Arrow my default as it is developed and supported by MS and it works very well. No crashes.

So, how do I like the S8?
Well, it is superb. Fast, shiny, feels good and looks great. It is a tad more narrow than I would prefer, but that is a small thing and easily overlooked. Battery life is decent, but I think older Alcatel Fierce XL had better battery life. The curved, infinity screen is fine, but I am not sure I like the infinity screen: I inevitably do something I didn’t want to do. I do not think the curved sides are all that useful either. I’ve not seen anything that really utilizes them.

The fit and finish is superb. This phone feels like it is expensive and looks like it as well. Of course, it is expensive, around $600 to $800 (US). I really like the hardware. It is fantastic.

What about Android?
Well, I still hate Android, just not as much. I could grow to like it. In time. Maybe.

What’s good about Android?
This is a bit hard as there are certain things I really like, but I am not sure they are actually Android or Samsung developed. For instance, I like the softkey bar. home button, task button and back button are easily accessible and get out of the way when not needed. I am not sure if this is stock Android or Samsung. It’s nice, though. I also like skinning ability, but, again, I see more Samsung than Android. I know Android can do this, just not sure how much is one or the other. Android also seems to be more stable than I recall. The notification system is fantastic, but a pain in the rear as well. I think, overall, Android has come a very long way. BUT…it is still ANDROID and not Windows Mobile and therein lies most of my problems with it.

What’s bad about Android?
It is not Windows Mobile 10. Windows Mobile 10 had its live tiles, was so much easier to navigate and Edge has turned into an excellent mobile browser. Integrated Cortana worked well. Android is none of this. ‘OK, Google’ is a joke. The deafness of the launcher screens, the navigation is not very intuitive and the overall appearance of Android-while better than in the past-still has a long way to go. Material Design seems to be missing and Google Services do not seem to be any better than those from Microsoft or–gasp–Apple. Except for one big exception.

So, what’s the exception?
Google Photos is top notch. I really like this service. To steal a saying from Apple…it just works. It works when I do not ask it to do so. And, the results are very impressive. I thought Microsoft Photos, with the new video storyteller, was going to be best in class. I was wrong. Microsoft’s new Photo additions are great, but this service is even better. Try it. You. Will. LOVE IT.

So, I am out of the Windows Mobile ecosystem, probably for good. I don’t know how long I will be an Android user, but, if things continue the way they are, I don’t see myself going anywhere else for a very long time.

Microsoft’s deception: the Photo’s app in the post-creators release

Frustration.  That’s the word to describe what it can be like to be a Windows Insider.

Awesome! Another word to describe what it is like to be a Windows Insider.

The two words are, generally, not used at the same time to describe the experience.

Recently, however, that was, in fact, the case.

As an Insider, when Microsoft introduces new features or changes to Windows and asks the Insiders to bang away, we trust that the feature we are asked to go test is, you know, actually there.  Such was the case, very recently, when new features were added to the Photos app in Windows 10.  Microsoft made a huge deal out of the new features: ability to create a sharp video out of video clips and photos. It could pair it the right music and will have the ability to inject 3D objects that could interact with the objects in the video. It looked spectacular.  But, as it was to be an early release, not all features would be immediately available.  As it turned out, many insiders didn’t get the new features at all. See, what Microsoft failed to reveal was that a subset of Insiders were prevented-so the story goes-from getting the new stuff, on purpose, to serve as a ‘control’.  Now, why they needed this ‘A/B’ test is beyond me. I could see it for, say, different file systems–see who it worked on better, compared to a control population, but not for a feature so prominently featured in the BUILD 2017 conference. It was covered by all of the tech press and non-tech press.  One would think they would want maximum coverage. It is a cool feature.  But, no.  Microsoft saw fit to hold it back from many, including myself.  For reasons I don’t yet understand.  We were able to get the new bits, after emailing a request, signing a eula and waiting. A really nice, and patient, young lady helped through the ridiculous exercise. I finally got the features almost a week later. I was beginning to think it was bogus and only a few journalists had received it.  This is yet another example of Microsoft’s inability to capitalize on anything. While the features are pretty good, the experience is sub par because of what I had to go through.

So, that was the frustration part.

The more I use the new features, though, the second word comes into play.  Simply put, the new features are awesome with the best still to come. The slickness of the resulting video is striking and the ability for the application to pull out snippets of video is just cool. So, once I did get the new bits, the awesomness took over.

While the resulting goodness of the new Photos app is clear, and I appreciate the help the young lady provided while trying to get the new bits, it does not excuse the bait and switch that Microsoft subjected us to, nor does the lame excuse they gave.  Seriously? An ‘a/b’ test on a PHOTOS app? Really?

 

 

Verizon takes an OATH: the death of AOL and YAHOO!

Two of the Internet’s oldest and most well known names, Yahoo! and AOL, will soon cease to exist.  With their purchases by Verizon, both companies will be merged into something called OATH.  While it remains to be seen just how well the combined company will do, one is for certain, neither company is anything like the companies we knew and loved or loathed, back in their heyday.

Indeed.

Yahoo! was THE search site. Period.  It was the Google of the late nineties and very early double-aughts. If you needed to find something, you went to Yahoo!.  I used Excite, a lot, but, like today and Bing, I found myself always using Yahoo!  Then, at some point, it became Yahoo! Powered by Google.  What? What’s this ‘google’?  I know it is a very big number that Carl Sagan used to talk about…but, what’s this ‘powered by google’?  So, I used Yahoo! to search for google.  The aforementioned number was the top choice, then…Google.com. I click the link and…viola! This empty page, except for the search bar and ‘google’ popped up.  Well, it looks like Yahoo! has company.  I eventually gravitated to Google for my searches.  Excite went belly up, as did most of the other search engines.  But, Yahoo! and Google were there.  Oh, this ‘MSN Search’ thing too…it eventually became useful and its name changed to Bing!, but that was years later.

Yahoo! lingered on…buying up hot properties in a desperate attempt to remain relevant, but…to no avail.  It became relegated to a collection of has-been properties, a few of which are still regarded in some fashion.

Only a few short years ago, Yahoo! was worth tens of billions of dollars.  Microsoft offered something like thirty billion to buy them, but then-CEO Jerry Yang figured that he could get ‘a better deal’ and held out.  He didn’t. He lost his title.  Marissa Mayer was brought in to right the ship…she couldn’t either.  Verizon got it for a tenth of what Microsoft had offered, not even a decade ago. I won’t even talk about the lack of security. Yikes.

America Online.

What can I say? I loved AOL.  I joined in 1992.  It was my favorite past time, well, other than a certain type of human interaction, that is.

Wow, just think, I could click a button, this loud, screaching sound came out of somewhere and, in a minute, I was ONLINE!  I had all kinds of things to do…look stuff up, download pictures, software, source code, short video clips…man, that was cool.  Sure, it took a LONG time to download files that, today, are smaller than most images on a web page, but, this was the early 1990’s and the Internet was new and not widely available. Bulletin boards were the hot things and these ‘chat rooms’ on AOL…yeah, those were cool. Perhaps the ability to share my knowledge with anyone was my favorite thing to do ‘online’.  I had written several demos and applications in this Visual Basic for DOS thing that was, for a few days, HOT.  Yep, HOT.  At least in the VB ‘room’ on AOL.  My demos and app were downloaded were downloaded…what, a dozen times.  Wow.  There was one demo, a phone dialer, that was downloaded about fifty times…I thought I was IT. Yep, fifty times. How freaking cool?

Well, as time went on, this Internet thing got big. REALLY BIG. And so did AOL.  AOL WAS THE INTERNET. For many, many people.  Think about that.

By 1998 or 1999, AOL was bigger than most tech companies. So big, in fact, that it bought Time-Warner Communications in 2000.  What a colossal mistake.  What AOL never counted on was the quick adoption of  high speed internet.  And the internal resistance within the Time Warner part of the company was overwhelming.  “these snot nosed punks aren’t coming in here to tell me what to do.”

By 2005, AOL was dead.  At least, to most they were. The company was still doing OK. It eventually spun off from Time Warner.  It became a collection of popular blogs and, believe it or not, they still had a sizable dial up customer base.  However, it wasn’t enough.

Verizon bought them.

And, now, they will be called Oath.

Admittedly, there’s a certain nostalgia surrounding both companies. That sound from-whatever-when you logged into AOL.  The anticipatory ‘You’ve got mail’. The excitement when the AOL home screen popped up (and, boy, that original DOS AOL client was both beautiful and cool) and, later on, the AOL Browser.  Yahoo! on AOL.

You know, now that I think of it, I kind of miss that sound from whatever and that anticipatory ‘You’ve got mail.’  Only kind of, though.

 

Embedded Tiny Basic Updates are Coming

I am in the process of updating Half-Byte Embedded Tiny Basic.  The new Volt function, the Year function and a few other enhancements are on the way.

As with HB Tiny Basic 3, the Volt function returns the system reference voltage:

200 V=VOLT(0)
210 PRINT "Voltage is ",V,".",V%1000

So, if your reference voltage is 4.930 volts, the VOLT function would return:

4930

The code snippet above would return:

Voltage is 4.930

Year(0) simply returns the current year if you have an RTC attached.

Other enhancements will include:

  • Support for limited LED animation
  • MOTOR control
    
  • Ability to utilize a light sensor to dim the LED array based on lighting in 
    the area.
    
  • Keypad support

And, one idea I am toying with–and it would depend on the amount of free space left–is some limited support for an LCD screen. I have not yet decided if it would be of the 2×16 variety or something like a Nokia 5110.  Again, it depends on the amount storage that is left.

Tokenizing the language would save a ton of SRAM for your apps, so I am looking into doing this as well.  I have been looking at how others do it and I don’t think It would be very difficult to retro fit it into the language. Of course, I could just start over…

Assembling the NKC 65k Color LCD Shield

Assembling the NKC 65k Color LCD Shield

The NKC 65k Color LCD Shield isn’t difficult to assemble, it is, however a bit time consuming.  The most difficult part of the assembly is soldering the connector board to the LCD itself. You must carefully line it up on both the LCD AND the shield board itself.  More on that in a moment.

To begin, first make sure you have all of the parts. Compare the packing list with what you have. Once you are sure you have every thing, you need to start with the LCD.  Take the very small connector board and, carefully, solder one of the strips to the LCD. You will know where, it’s kind of obvious, but, in case you can’t, on the shield board, look for the outline

lcdconnectorboard.jpg

LCD Connector Board

of the LCD.  On the component side, you will see several solid tracks that appear to go nowhere. This is what you will have to line up.  Once you place the LCD on the Shield board and line them up…the LCD has a tit that goes through the board on one side, line it up using that. Once satisfied, remove the LCD and continue to solder the connector board to the LCD. When you are done, place the LCD back on the shield, make sure the board lines up and then solder it to the shield board.  Congratulations, this was the toughest part of the assembly.

 

The official instrucWP_20170201_21_48_05_Pro.jpgtions say to solder the header now.  I would advise to wait. The problem is that the resistors are difficult to solder if you insert and solder the headers first. So, I would solder those outer resistors next.  Those are the 1K and 10K resistors. While you are at it, solder all of the small, .1uf capacitors (the little bright blue capacitors) into place. A few of these are also next to the headers and in difficult spots if the headers go first.

Solder the remaining resistors into place.  The board is clearly marked, so it should be very easy to figure out where to solder them.

The two large 10uf capacitors are polarized, meaning they must be soldered in a specific way. Notice they both have a gray arrow on them, that is the negative side and must be soldered in with the arrow pointing to the negative sign or round hole on the board.C1 would have the gray arrow facing the LCD and C7 has it facing the Max232 Integrated Circuit.

For the large LM317, place in the three holes, flat side facing toward the Max232.  Solder the center pin.  Carefully, bend the LM317 backward so it is as flush to the board as you can get and solder the remaining pins.

If you have a 16 pin, through hole IC socket (one does not come with the kit) I would suggest you use it in the assembly. It is ok if you do not, it makes it easier if, for some reason, you should ever have to swap the chip out.  If you have the socket, go ahead and solder it to the board, paying attention to pin one.  If you do not have the socket, insert the chip with pin one facing the edge of the board. Pin one is where the ‘u’ shape is on the outline of the chip on the board. Once you are satisfied that you have pin one in the proper place, solder the chip to the board.

The only things left should be the headers. An easy way to solder them in is to place them in your Arduino UNO and then carefully place the board over them, making sure the pins penetrate the board. Solder them.

WP_20170201_22_30_35_Pro.jpg

The Completed Board

 

 

Wow, you’ve assembled your board.  Now you need to test it.  There is a demo sketch (two of them) on the NKC Electronics web site.  Download them and then up load to your Arduino. If all went well, you see a short demo on the screen.

This is a busy but useful board and a ‘fun’ project. It shouldn’t take more than a couple of hours to assemble and test.  There are better panels out there, but this kit is currently $4.95 and could be useful in a monitoring project, a game or for an at a glance status for one of your project.

Have fun!

Official assembly guideWP_20170201_22_36_47_Pro.jpg

Demo 1 - direct I/O

Demo 2 - using digital read/write

Demo 1 is much faster and is what I would use 
for things that need speed.

Updated Half-Byte Tiny Basic v3

101_3353.jpgI have posted a new version of Half-Byte Tiny Basic v3. You can grab the .ino file here. If you already downloaded v3, download the new .ino file and is should compile in Arduino 1.6.x. I made sure it compiled in 1.6.7 before uploading it.  It is the same as the previous version, except that it has one new function: VOLT(0).

VOLT returns the reference voltage as an integer in the thousands.  Divide by 1000 and get the remainder. You can do so like this:

100 CLS
110 V=VOLT(0)
120 A=V/1000:B=V%1000
130 PRINT "THE REFERENCE VOLTAGE IS:",A,".",B
Run the code. Say your board's voltage is 4.954 volts, the output would be:
THE REFERENCE VOLTAGE IS:4.954

Of course, you don’t need to divide it, you simply use the returned value to get a better reading on an analog pin. Use it to monitor a sensor, etc. TREAD works in a similar way as well.

The next version of the language will include more low level hardware interfacing to make controlling motors and other things much easier.

Please try this version and let me know, via the comments, if you had problems compiling and uploading to your board.  Feel free to comment on the language, what you like, don’t like, etc.  I do listen and have incorporated many suggestions and will credit what ever I use.