Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:50 13 Jul 2025 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 : Webmite driving me crackers...

     Page 2 of 2    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 09:49am 07 Dec 2024
Copy link to clipboard 
Print this post

I've abandoned Webmite for the moment. I decided that it was easier to redesign the Aquarium Controller to have a display as it doesn't need much control. It gives me an excuse to put SMD MOSFETs in instead of the ULN chip too, and to introduce backlighting using a WS2812B strip. :)  All done on a RP2040-Zero this time.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Malibu
Senior Member

Joined: 07/07/2018
Location: Australia
Posts: 260
Posted: 06:01am 08 Dec 2024
Copy link to clipboard 
Print this post

Don't give up yet Mick... Try this and it might help out

OPTION EXPLICIT

'basic web server

dim string Off$, Onn$
dim Integer CurrentTemp

'get the time
WEB ntp
Pause 1000
Print "Server started at "Time$
Print

Dim buff%(4096/8)

Off$ = "checked"
Onn$ = ""

WEB TCP INTERRUPT WebInterrupt


Do
'<do your processing here>'
CurrentTemp=26
Loop


' sub to handle all web server requests
Sub WebInterrupt
 Local a%, p%, t%, s$
 For a%=1 To MM.Info(max connections)
 WEB tcp read a%, buff%()
 if llen(buff%()) > 0 then
   'LongString print buff%()
   If (linstr(buff%(), "GET / HTTP") > 0) or (linstr(buff%(), "GET /index") > 0) then
     WEB transmit page a%,"/index.html"
   elseif linstr(buff%(), "favicon.ico") > 0 then
     web transmit code a%, 205
   elseif linstr(buff%(), "RB=ON") > 0 then
     ? "Turning RB to ON"
     Off$ = ""
     Onn$ = "checked"
     WEB transmit page a%,"/index.html"
   elseif linstr(buff%(), "RB=OFF") > 0 then
     ? "Turning RB to Off"
     Onn$ = ""
     Off$ = "checked"
     WEB transmit page a%,"/index.html"
   else
     ? "Other request found, sending 205 code"
     web transmit code a%, 205
   endif
 endif
Next a%
End Sub    



<html>

<head>
<title>WebMite</title>
</head>

<body>
<h1>Aquarium Control</h1>
<h2>{date$}  {time$}</h2>
<p>The tank temperature is {ttemp}C
<br>
The current lighting preset is number {colr}
</p>
<br>
<br>
<br>
<form id="radiotest" name="radiotest" method="post" action="">
Coloured Lighting
<input type="radio" id="RB" name="RB" value="OFF" onclick="submit(this.value)"{off$}>Off
<input type="radio" id="RB" name="RB" value="ON" onclick="submit(this.value)"{onn$}>On
</form>
</body>

</html>


Works on Opera and Firefox for me - I don't use Chrome, but see how it goes for you

For the Favicon request, I've just added the 205 code, but you can use a real favicon if needed
John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 07:08pm 09 Dec 2024
Copy link to clipboard 
Print this post

Thanks John. I'll give it a try, but just at the moment I'm a little busy.  :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Malibu
Senior Member

Joined: 07/07/2018
Location: Australia
Posts: 260
Posted: 03:59am 10 Dec 2024
Copy link to clipboard 
Print this post

  Quote  I'll give it a try, but just at the moment I'm a little busy

No worries, it's there when/if you need it... and yeah, it's the busy season, so totally understood!
I've been playing with the UDP comms instead of TCP. It seems to be more stable - maybe that's another option for your controls?
John
 
     Page 2 of 2    
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025