Thursday, June 16, 2022

Spaces to code.

I've recently come across some interesting sites, that help you run code on line. This is not a new idea been around for a while but I like these ones. As they are quite beginner friendly and they are very interactive code and see your results. It is possible to embed content into other sites and online media.  

The first is https://glitch.com/ it offers Glitch’s basic features for free. This in includes a intuitive code editor for projects with 
 
  • Projects and code are public by 
  • default Full-stack apps that sleep after 5 minutes 
  • Unlimited static 
  • sites that are always on 
  • Github import/export and Prettier support 

It uses what it calls remixing where you fork prebuilt projects. Most are based on nodejs but other languages are posible. As it is mostly nodejs you have an address where you can view your output. Like this https://now-look-up.glitch.me/, notice it is the project name at glitch.me domain. Note if it is not a basic static site https://now-look-up-static.glitch.me/ it may take a time to come up. 

Things I don't like is it is too easy to click a remix and removal of projects involves emailing support to remove it.

My second contender is https://replit.com/ this also has a free plan giving
  • Unlimited Repls 
  •  Free storage 500 MB 
  •  500 MB memory 
  •  0.2 - 0.5 vCPUs 
  •  Live multiplayer collaboration
  • Github linking
They also shut down if not accessed.
The site is mostly Python based but you have a a claimed 50+ languages. only use Python and Nodejs myself.
 

Which can be embedded in most web pages. https://docs.replit.com/hosting/embedding-repls 

This is not a tutorial as there are loads for these sites and the documentation is generally good. See links :

Wednesday, January 4, 2017

raspberry pi rtc checking part1

I have a Real Time Clock board (TinyRTC V1.1) from Arduino kit but suspected it was faulty or needed a new battery as it was not keeping time on the Arduino. Having a raspberry pi zero I decided to investigate using this.
The raspberry pi zero does not have it's own RTC and uses Network Time Protocol servers to get it's time when connected to a network. It also has kernel modules for dealing with the DS1307 on the  (TinyRTC V1.1) .

After a quick Google (other search engines are available) I found this article RTC Pi on a Raspberry Pi with Raspbian , the first part shows how to set up the DS1307   as hwclock device. by using "sudo hwclock -r" gives the DS1307 time "Wed 04 Jan 2017 18:25:55 GMT  -0.965293 seconds" which can be compared against "date" giving time and date in the format Wed 04 Jan  09:25:55 GMT  2017" this is from the NTP servers set up when connected to a network.

The details of NTP client are explained here http://raspberrypi.tomasgreno.cz/ntp-client-and-server.html.  It looks like the NTP client is pre installed on  Raspbian Jessie. This should give me a reference for my RTC.

I used "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device" to link in my RTC. So decided to have a poke around in "/sys/class/i2c-adapter/i2c-1".

ls /sys/class/i2c-adapter/i2c-1
1-0068         device   name        of_node  subsystem
delete_device  i2c-dev  new_device  power    uevent

1-0068 look a interesting place to go?

ls /sys/class/i2c-adapter/i2c-1/1-0068
driver  modalias  name  nvram  power  rtc  subsystem  uevent

Going down gave.
ls /sys/class/i2c-adapter/i2c-1/1-0068/rtc/rtc0
date  device   max_user_freq  power        subsystem  uevent
dev   hctosys  name           since_epoch  time

And at the bottom
cat /sys/class/i2c-adapter/i2c-1/1-0068/rtc/rtc0/time
08:49:05
gave up the time and "cat /sys/class/i2c-adapter/i2c-1/1-0068/rtc/rtc0/date" gave up the date in 2017-01-04 format.

 cat /sys/class/rtc/rtc0/time
09:47:44

also gives time. Both are only there when DS1307 is installed via "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device" from "sudo bash"

The raspberry pi zero keeps the time when not connected to network in "fake-hwclock" so the bash commands line "cat /etc/fake-hwclock.data" returns date time in this format "2017-01-04 10:17:01"

All I need do now is to run a long time test and compare the NTP time with RTC time..........


Wednesday, December 14, 2016

Why raspberry pi zero is not for faint hearted?


The story starts with family wanting to watch streaming TV as Digital terrestrial TV is not the best with us. I read an article about using Kodi on a Raspberry Pi. Raspberry Pi 3, Noobs MicroSD and old USB keyboard with a few hours and I had one media player. Exhalent but it got me intrigued….
After a bit of searching on the net and I found £4 for a Raspberry Pi zero and I was sold what could go wrong?

Well a lot really first one I ordered would not work checked the microSDs in the Raspberry Pi 3 ok.  Ordered a replacement (impatient me) and was about to send back the first so started checking simple stuff like power and clocks.  I work in the trade so have access to equipment. Power was coming up and then dropping from 3v3 to 2v8 odd?
When I looked under a microscope, I could see filaments of solder around the regulator chip. Wiped them off and it booted. Second Zero booted first time.
But the zeros would not boot off some microSDs that worked on Raspberry Pi 3 anything bigger that 16GB in my collection of microSDs would not boot. I even ran Raspbian Jessie Lite on a 4GB from an old phone. If anyone knows a source of 32GB microSDs that work in zeros let me know.
The zero only has one USB port so you need a hub, I also have a collection of these. It does not have WIFI or Ethernet so to make it connected you will need a hub.  Odd things happened here I used one of those OTG shims to connect to USB hub flashed the light on the hub and showed the wifi icon on the screen but no working keyboard or mouse. Keyboard worked without hub?

To set stuff up I used the serial terminal see this link http://elinux.org/RPi_Serial_Connection. Now I could go in and set up USB WIFI dongle got two different ones working but that’s a different story.  Now I had network I could use VNC (https://www.raspberrypi.org/documentation/remote-access/vnc/) works sometimes and not others. I can now do stuff with it, via serial terminal and VNC. 
You can do so much. I have for example:
·         Set up PHP web servers.
·         Samba file and media servers.
·         Connected sensors ( acceleration, magnetic, humidity, air pressure and temperature)

On the whole a very useful box but if you want a desktop get a Raspberry Pi 3.

Thursday, September 29, 2016

MBED non standard Boards

I was put off MBED by the fact you have to by board for the listed ones on the site.
Then I found this post https://developer.mbed.org/questions/7443/Using-mbed-with-generic-STM32F103C8T6-ch/ and this article https://developer.mbed.org/users/hudakz/code/STM32F103C8T6_Hello/

I have a number of STM32 board left over from sample dev-kits. So I picked out one that was not really good for much. Enter the M24SR-DISCOVERY http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/st25-nfc-rfid-eval-boards/st25-nfc-rfid-eval-boards/m24sr-discovery.html
which was made to sell the M24SR64 device for RFID.  RFID was all the rage recently but turned out to not give all it promised. To cut a long store short I have a board with LCD and very little IO pulled out to pads.

Using said board and info in links I did my own project on MBED,
https://developer.mbed.org/users/lloydg/code/M24SR-DISCOVERY-testbed/

it currently shows some graphs and port reads. I have not looked at the M24SR64 device as I can't think of anything to use it for.

Check out other post on using non standard Boards on MBED.
https://developer.mbed.org/questions/53937/STM32F3-Discovery-or-STM32F4-Discovery-a/
I have a stm32f4-discovery not the one with MBED support built in so I selected  a Arch Max board with same processor but I need to add my own library to handle pin functions for the different peripherals.
See this post- https://developer.mbed.org/questions/68507/Following-STM32F4DISCOVERY-KIT-FOR-STM32/










Thursday, May 26, 2016

If your ever stuck signed in to github?

https://github.com/logout

will save you.

Some old browser let you sign in but you can't find sign out dropdown.

This did not come from help or search, I worked it out.

first try was
https://github.com/signout

but this is a user??
hope no one choses logout. what will we do then?
Don't even think about it!!


Monday, March 7, 2016

Arduino cores


If you are one of the few who don't know what one is look here:
This is the Swiss army knife or sonic screwdriver of the micro world. With a simple IDE and libraries for any sort of hardware you can think of. The basic Arduino is a ATmega 8-bit Microcontroller.
The real Big Idea in my mind is that the code can be ported to other micros and platforms or cores in Arduino parlance.
Here are some that I have looked at:
And others I've not, see this list