Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:30 18 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pi-cromite . A NOOBSys attempt

     Page 2 of 2    
Author Message
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3678
Posted: 07:25am 21 May 2017
Copy link to clipboard 
Print this post

  MicroBlocks said  I feel Linux is just in the way and could totally be unnecessary if it was possible to write/compile for the barebones of it.

That's rather awkward due to all the proprietary things (I/Os) in the Raspberry Pi that they refuse to release details about, let alone the code to support them.

Would be much easier to go for another good value ARM board (or board family) where far more in-depth data exists.

Far more and better I/Os often exist on those, too.

Allwinner (A20 etc) chips spring to mind.

JohnEdited by JohnS 2017-05-22
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 08:45am 21 May 2017
Copy link to clipboard 
Print this post

  JohnS said  ...Would be much easier to go for another good value ARM board (or board family) where far more in-depth data exists.

Far more and better I/Os often exist on those, too.


Better 'quality' does not necessarily 'win the day' (remember VHS and BetaMax video-recording systems!).

There are well over 8 million Raspberry Pi's out there and if the speed of this port continues in the way it has over the last few weeks then it will open up MMBASIC to many 'new' people. The ARM boards are no doubt 'good' (even 'great'); but they are also currently a bit too specialist IMHO. And I bet there are nowhere near 8million out there - let alone a multitude of Magazines on the high-street shelf as there are with the RPi.

What Peter has achieved with Geoff's code for the Pi certainly amazes me. I'd rather he carry on this outstanding port; and possibly someone else (JohnS maybe?) pick up an ARM board port if they think it worthwhile.

Another point to bear in mind is the endless 'add-ons' for the RPi that MMBASIC will effectively have access to. I have already programmed several HATs in MMBASIC avoiding the need to build new hardware modules.

The above is just my opinion for getting MMBASIC 'to the masses'; and I truly believe a RPi port is the best approach to give a massive 'boost in numbers' of users. No doubt others will disagree . . . .

WW

(Edited: Too many spelling mistakes!)

Edited by WhiteWizzard 2017-05-22
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3678
Posted: 08:52am 21 May 2017
Copy link to clipboard 
Print this post

But that does not address the point my post was all about: doing without Linux as MicroBlocks asked.

Realistically that is not possible with RPi boards.

(I'd rather have Linux, but that was not what I was replying about.)

BTW there are vastly more than 8 million A20 boards out there! Over 80 million, never mind 8. They typically run Android (which is a version of Linux).
And a similar number of A10 boards. Also A31/A33. Etc.

JohnEdited by JohnS 2017-05-22
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:40am 21 May 2017
Copy link to clipboard 
Print this post

Maybe a stripped down linux so that MMBasic is the main thing running.
I really think a distribution that includes MMBasic would be the best way forward.
Insert sd card, run seup and ready.

I am not very familiar with Linux as many others. Most will benefit from that, and it will surely give good exposure to MMBasic and the other micromite versions.

I would do it, but it is too unfamiliar for me.

Microblocks. Build with logic.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3678
Posted: 11:06am 21 May 2017
Copy link to clipboard 
Print this post

Trouble is, everything left out of the usual Linux may be wanted by someone and they're liable to fall foul of it, especially as these are going to be the least experienced about Linux (they won't want this special distro otherwise).

Someone with plenty of free time to help them will be needed as well as with the time to create and maintain a special distro.

Doesn't look attractive!

John
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 05:02pm 21 May 2017
Copy link to clipboard 
Print this post

Hi All,

I am becoming convinced I have a software issue here.. I have `ALMOST' got it running..

I ran the html.bas program (cut and pasted from this that Peter posted)

[code]
option explicit
option default none
Const starttemp = 18
Const maxargs = 32
Const relaypin=7
Const off=0
Const on=1
Dim a%(1000),i%
Dim integer sp(11)
Dim s$,pg$
Dim security$="123456"
Dim string cp(11)
Dim float tcurrent,tnew
Dim float tmax=-1000
Dim float tmin=1000
Dim arg$(1,maxargs-1)
Dim integer checked=0
Const check$="checked='checked'" 'string to set a readio button pressed
Dim string heating="off"
Const hon$="#ff0000" 'red
Const hoff$="#00ff00" 'green
Dim string hcol=hoff$
'
SetPin relaypin,dout
For i%=0 To 10
sp(i%)=i%+starttemp-1 'set up the temperature values
cp(i%)="" 'set up the radio buttons as not pressed
Next i%
tcurrent=TEMPR(11) 'get the current temperature
cp(checked)=check$
Open "socket,myint,100" As #2
Do
TEMPR START 11
Pause 2000
tnew=TEMPR(11)
If Abs(tnew-tcurrent)<10 Then tcurrent=tnew
updateheater
If tcurrent>tmax Then tmax=tcurrent
If tcurrent<tmin Then tmin=tcurrent
Loop
'
Sub myint
Local p%=0, t%=0
Local g$
Do While Not Eof(2)
LongString append a%(),Input$(10,2)
Loop
p%=LInStr(a%(),"GET",1)
t%=LInStr(a%(),"HTTP",1)
If p%<>0 And t%<>0 Then 'full request received
s$=LGetStr$(a%(),p%,t%-p%+4)
LongString trim a%(),t%+4
pg$= parserequest$(s$,i%)
If i% Then
If arg$(0,0)="Security" And arg$(1,0)=security$ Then 'valid update
If arg$(0,1)="R" Or arg$(0,2)="R" Then
cp(checked)=""
If arg$(0,1)="R" Then checked=Asc(arg$(1,1))-Asc("A")
If arg$(0,2)="R" Then checked=Asc(arg$(1,2))-Asc("A")
cp(checked)=check$
updateheater
EndIf
If arg$(0,1)="Check" Or arg$(0,2)="Check" Then
tmin=tcurrent
tmax=tcurrent
EndIf
EndIf
EndIf
'
If pg$="index.html" Then
Transmit page "index.html"
Else
Transmit code 404
EndIf
EndIf
End Sub

'Function to parse an HTML GET request'
' Assumes that the request starts with "GET /"
' and ends with "HTTP"
'
Function parserequest$(req$, paramcount As integer)
Local a$,b$
Local integer inpos,startparam,processargs
For inpos=0 To maxargs-1
arg$(0,inpos)=""
arg$(1,inpos)=""
Next inpos
paramcount=0
a$=Mid$(req$,6,Len(req$)-10)
inpos=Instr(a$,"?")
If inpos<>0 Then 'parameters found
processargs=1
parserequest$=Left$(a$,inpos-1)
a$=Mid$(a$,inpos+1)
Do
arg$(0,paramcount)=""
arg$(1,paramcount)=""
inpos=Instr(a$,"=")
startparam=1
arg$(0,paramcount)=Mid$(a$,startparam,inpos-startparam)
startparam=inpos+1
inpos=Instr(a$,"&")
If inpos<>0 Then
arg$(1,paramcount)=Mid$(a$,startparam,inpos-startparam)
a$=Mid$(a$,inpos+1)
paramcount=paramcount+1
Else
arg$(1,paramcount)=Mid$(a$,startparam)
paramcount=paramcount+1
processargs=0
EndIf
Loop While processargs
Else
parserequest$=a$
EndIf
If a$="" Then
parserequest$="index"
EndIf
If Instr(parserequest$,".html")=0 And Instr(parserequest$,".HTML")=0 Then
parserequest$=parserequest$+".html"
End Function

Sub updateheater
Local float hcalc
If checked=11 Then
Pin(relaypin)=1
heating="On"
hcol=hon$
EndIf
If checked=0 Then
Pin(relaypin)=0
heating="Off"
hcol=hoff$
EndIf
If checked>=1 And checked<=10 Then
hcalc=checked+starttemp-1 'setpoint temperature
If tcurrent>hcalc Then 'turn heating off
Pin(relaypin)=0
heating="Off"
hcol=hoff$
EndIf
If tcurrent<hcalc Then 'turn heating on
Pin(relaypin)=1
heating="On"
hcol=hon$
EndIf
EndIf
End Sub


then I used the html code he posted here and saved it as index.html (maybe this is my problem)


<html>
<head>
<title>Remote Thermostat</title>
</head>
<body>
<form name='f1' method='get' action='index'>
<h2 align='left'>Remote Thermostat V4.0</h2>
Update Code: <input type='text' name='Security' size='6' value='000000'>
<br>
<p>
<TABLE BORDER='1' CELLSPACING='0' CELLPADDING='5'>
<TR>
<TD>Heating</TD>
<TD BGCOLOR='{HCOL}'>{heating}</TD>
</TR>
</TABLE>
</p>
<p>
<TABLE BORDER='1' CELLSPACING='0' CELLPADDING='5'>
<TR>
<TD></TD>
<TD>Temperature</TD>
</TR>
<TR>
<TD>Current</TD>
<TD>{TCURRENT}°C</TD>
</TR>
<TR>
<TD>Max</TD>
<TD>{TMAX}°C</TD>
</TR>
<TR>
<TD>Min</TD>
<TD>{TMIN}°C</TD>
</TR>
</TABLE>
</p>
<input name='Check' type='checkbox' value='Reset' onClick='this.form.submit()'>
Reset Max/Min<p>
<TABLE BORDER='1' CELLSPACING='0' CELLPADDING='5'>
<TR>
<TD>Thermostat</TD>
<TD><input name='R' type='radio' {CP(0)} value='A' onClick='this.form.submit()'> Off<br></TD>
<TD><input name='R' type='radio' {CP(1)} value='B' onClick='this.form.submit()'> {SP(1)}°C<br></TD>
<TD><input name='R' type='radio' {CP(2)} value='C' onClick='this.form.submit()'> {SP(2)}°C<br></TD>
<TD><input name='R' type='radio' {CP(3)} value='D' onClick='this.form.submit()'> {SP(3)}°C<br></TD>
<TD><input name='R' type='radio' {CP(4)} value='E' onClick='this.form.submit()'> {SP(4)}°C<br></TD>
<TD><input name='R' type='radio' {CP(5)} value='F' onClick='this.form.submit()'> {SP(5)}°C<br></TD>
<TD><input name='R' type='radio' {CP(6)} value='G' onClick='this.form.submit()'> {SP(6)}°C<br></TD>
<TD><input name='R' type='radio' {CP(7)} value='H' onClick='this.form.submit()'> {SP(7)}°C<br></TD>
<TD><input name='R' type='radio' {CP(8)} value='I' onClick='this.form.submit()'> {SP(8)}°C<br></TD>
<TD><input name='R' type='radio' {CP(9)} value='J' onClick='this.form.submit()'> {SP(9)}°C<br></TD>
<TD><input name='R' type='radio' {CP(10)} value='K' onClick='this.form.submit()'> {SP(10)}°C<br></TD>
<TD><input name='R' type='radio' {CP(11)} value='L' onClick='this.form.submit()'> On<br></TD>
</TR>
</TABLE>
</p>
</form>
</body>
</html>




Now if I go to my Pi from my PC (or from the Pi browser itself to

10.0.0.50/favicon.ico
or
10.0.0.50/tiger-3.jpg

I get the little raspberry or tiger image..

but when I just go to 10.0.0.50 i get a long wait and no data found

When I look at the pi terminal screen I see it has crashed out with an error

Error: Array Dimensions


So Ahaa I am getting somewhere, the problem is, i believe, my index.html file.. There is NO index.html file in the original ZIP of the webserver (first post) and I have used the HTML code listed by Peter on the last post of page 1 of this page as the content for the non-existent index.html file..

I think that assumption is incorrect.

So, in summary, I think I have an issue with there being no index.html file..

Also after the server crashes (by trying to run the index.html file I made from Peter's post) the Pi terminal screen needs to be closed and then re-loaded and file loaded and run before it will respond again.. I assume some port is left in an illogical state when the file crashes..

Can someone please post the correct index.html file please (and main html.bas if my cut and paste version is incomplete)..

I do not think it is an issue with my router and or the IP range as the serving goes well for the two graphic images.. it it the index.html file that crashes with Error: Array Dimensions that appears to be the problem.

I am probably doing something wrong but please realise I am not a programmer's a$$-hole (well actually I was told that I AM)

Kind Regards,

Mick





Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
led-bloon

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 204
Posted: 06:13pm 21 May 2017
Copy link to clipboard 
Print this post

Mick
if you don't have a DS18B20 connected to pin 11 then comment out all lines with a
TEMPR() command. You should then see an index.html page at 10.0.0.50 with buttons
(at least) but pretty much useless.
If you do have a DS18B20 connected to pin 11, I can't help as I don't have one, but
try commenting out TEMPR() commands anyway.
Good luck sunshine
led

Miss you George
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 07:12pm 21 May 2017
Copy link to clipboard 
Print this post

Hi Led,

Thanks... You are right no DS18B20 installed.... Yet!

That fixed the error I now see a basic temp scale table... I also did a simple index.html that I found on the NET and modified to display my text and show Mister Tiger and that works perfectly..

So I now have it running... Just needing a decent web page (index.html) to couple to it and it will be operational..

I must say though, I am not getting port forwarding to work on my new TPLINK D7 modem... There is no section labelled PORT FORWARDING and I have been trying virtual servers under NAT FORWARDING which seems as close as PF but it doesnt seem to function as I expected.. more play at a later time

Thank you one and all this has been interesting to say the least.

Kind Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:37pm 21 May 2017
Copy link to clipboard 
Print this post

  JohnS said   Trouble is, everything left out of the usual Linux may be wanted by someone and they're liable to fall foul of it, especially as these are going to be the least experienced about Linux (they won't want this special distro otherwise).

Someone with plenty of free time to help them will be needed as well as with the time to create and maintain a special distro.

Doesn't look attractive!

John

Those people could do it just as it is now.
I am not suggesting to make an exclusively MMBasic version.
Just a distribution that has all the ingredients necessary for running MMBasic on a as minimal as possible Linux configuration for (noobs :) )people to start with.
That way nothing can go wrong and every beginners situation will be equal.
After that tweak whatever you want and install whatever you want. It is just if you are interested in MMBasic and just use a Pi instead of an mcu it will provide a path with least potential problems.

Microblocks. Build with logic.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3678
Posted: 10:34pm 21 May 2017
Copy link to clipboard 
Print this post

Start with NOOBS/raspbian and just write up accurate and complete instructions.

Far easier.

Still needs someone with time and willing to put in effort.

John
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:09pm 21 May 2017
Copy link to clipboard 
Print this post

Would installing the NOOBS/raspbian and then the necessary io support and MMBasic not result in a SD card image that can be copied and shared.

I do that often with Virtual Machines. If i need a SQL Server i just take my Windows 2016 server with installed SQL Server 2016 image and start up another one. Takes five minutes.

RasPlex does it in a interesting way. It uses you PC to create an SD card that can be used in the Pi.
Edited by MicroBlocks 2017-05-23
Microblocks. Build with logic.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 03:24am 22 May 2017
Copy link to clipboard 
Print this post

  bigmik said  ... I am not getting port forwarding to work on my new TPLINK D7 modem... There is no section labelled PORT FORWARDING and I have been trying virtual servers under NAT FORWARDING which seems as close as PF but it doesn't seem to function as I expected


On my TL-WR841N router, under "Forwarding", "Virtual Servers" gives me the chance to set up port forwarding, both with the same incoming and local port and with different.

Of course, TPLink may have changed things between routers.


PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 05:27am 22 May 2017
Copy link to clipboard 
Print this post

Mick

The html you posted on this thread (page 3) is correct and should be saved as "index.html" in the same directory as MMBasic.

If you are getting array index errors make sure you aren't setting option base to anything other than zero.

If you look at the html it substitutes array elements 0-11 of arrays sp() and cp()
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 09:22am 22 May 2017
Copy link to clipboard 
Print this post

I can recommend "Conquer the Command Line" by Richard Smedley. It's a good refresher for those of us who knew enough about Linux to be dangerous as well as folks new to Linux.

The contents were covered in issues of The MagPi magazine and is also available to buy as a printed book.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 06:48pm 22 May 2017
Copy link to clipboard 
Print this post

Hi John, All,

  JohnS said   Start with NOOBS/raspbian and just write up accurate and complete instructions.

Far easier.

Still needs someone with time and willing to put in effort.

John


I am happy to knock some`idiots guide' (after all I am fully qualified as being a big idiot at times) up when I have a semi decent index.html and time to do so..

The examples were obviously written to have a temperature sensor installed.. My big oversight..

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024