Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By cicciocb
#47104 Probably your question is more related on OLED display (if I remember well).
The TFT has several commands / functions that are different and not applicable to the OLEDs.
MMISCOOL not yet released the documentation associated with it but there is a preliminary doc here :
https://github.com/cicciocb/Basic/blob/ ... _notes.txt

There is a command to change the text size
tft.text.size(x) where x is the scale factor. The font is always the same.
User avatar
By forlotto
#47121 Cicciocb you have any of those GPIO expanders for sale I'll buy 4 of them off of you :P Tell me how much and how much for shipping and payment method preferred dogecoin, bitcoin, paypal is what I can do.

Yes I suppose now that I am thinking a different way a weekly timer was possible a long time ago technically speaking. I think hourly rather than by the minute would work best for me but some people may want it down to the minute which blows I don't know if it is possible to be running different tasks on the esp8266 at the same time so if there is a collision it may execute something rather than the time not allowing for real time I suppose you could just scrape the time hrmmm...

Create Interface to store time values from user input: This is the most difficult part I believe of the whole weekly timer I can think of.
Have a current day register
Have a time to find register
Find current day get time string read first 2 letters of day. String search.
Check with if then's to determine what to put in current day register.
String search for time errr there is a problem I can think of here how does one go about knowing how to get just the time if the date, day, etc... is going to be different #'s of characters Errrrr got to thing on this one...
I forget is it possible with time to print just the time or just the day etc need to visit documentation on this one.

Errr what if time passes the timer up there needs to be padding in case this happens maybe only allow for timer for every 5 minutes .... Errr should not matter for on/off relay if you turn something on that is already on you essentially do nothing. So maybe in time check routine check if it is equal so timer would be best possibly at 5 minute intervals.

This makes me wonder is it possible to have more than one timer going at once what if for some odd reason both timers reach zero and two operations are supposed to take place at the same time hrmmmm could spell conflict I suspect.


Errr I need to do some thinking on how to do a weekly timer and a lot of reading after thinking this out loud.

Other notes I will need to store the user input times in a file such as json, or even a text document for each day of the week maybe IDK what is the most effective way?

Hrmmm a hell of a lot of questions I need to find answers to for a timer without actually looking at documentation.

Either way a good adventure I would imagine many people would love to have a weekly timer framework to build off of I feel this would be a large advantage to any other esp8266 interpreter available. It would help countless people develop things like weekly programmable thermostats on the cheap etc...

Imagine we now have a touch screen think about how dirty cheap it would likely be to make a touchscreen thermostat that could be updated via a web browser!!! I am sure there are many other things that could be done as well to be honest my minds eye is a little foggy today so I can't recall all of the things that could be done. A sprinkler system that works based off of weather data. Water every day at certain time if conditions are going to be rainy skip watering. Errr lots of other things but you all get the pic on where to go from this.
User avatar
By cicciocb
#47126 I made a little demo circuit, just as a demonstrator.
It works with an ESP-01 and a 8 relay board.
There is a little PCB directly connected to the relay board containing a 74Hc595, a voltage regulator and an IR receiver.
In the demo the relays can be controlled using the IR RC and via UDP using the UDP debugger utility.
There is a little cheat there, as there are very few GPIO pins available.
These are some pictures :
IMG_0025.JPG

IMG_0027.JPG

I published also a little video, showing how works with the IR RC:


The 74HC595 is commanded by bitbang but I plan to implement a dedicated function for the 74hc595 expander.
Using the UDP utility it's very simple also to command.
Simply type 1 to toggle relay1, 2 for relay2, 4 for relay3, 8 for relay 4 , ..... (binary bits)

This is the code :
Code: Select allmemclear
cls
print ramfree()
pi 1 a
ir.recv.setup(1)
irbranch [ircode]

udpbegin 5001
udpbranch [receive.UDP]

ss = 0
dat = 0
gosub [bitbang]

wait
end

''''''''''''''''''''''''''''''''''''
' WRITE to the 74HC595 shift register
' using the bitbang with 2 pins
' this function uses the variables
' dat = data - INPUT -
' use GPIO2 for the clock/store
' and GPIO0 for the data
'''''''''''''''''''''''''''''''''''
[bitbang]
ww = dat
po 2 0  'clock
for w = 0 to 7
  b = ww and 128
  if b = 0 then
     po 0 1
  else
     po 0 0
  end if
  ww = ww << 1
  po 2 1  'clock
  if w < 7 then po 2 0  'clock
next w
'store
return

[ircode]
'serialprintln "code received"
r = ir.recv.get()
'print r
if r <> "ffffffff" then
   if r = "8c7320df" then
     ss = ss xor 1
   end if
   if r = "8c73a05f" then
     ss = ss xor 2
   end if
   if r = "8c73609f" then
     ss = ss xor 4
   end if
   if r = "8c73e01f" then
     ss = ss xor 8
   end if
   if r = "8c7330cf" then
     ss = ss xor 16
   end if
   if r = "8c73b04f" then
     ss = ss xor 32
   end if
   if r = "8c73708f" then
     ss = ss xor 64
   end if
   if r = "8c73f00f" then
     ss = ss xor 128
   end if
end if
dat = ss
gosub [bitbang]
return


[receive.UDP]
ud = udpread()
ud = val(ud)
ss = ss xor ud
dat = ss
gosub [bitbang]
return


CiccioCB
You do not have the required permissions to view the files attached to this post.
User avatar
By cicciocb
#47128 Hi Forlotto,
I don't have any PCB available, all is prototype for the moment.
I usually do some PCBs for myself but I don't have the time / capacity to make PCB and sell them.
You can find a lot of PCBs already done with 74HC595 but I imagine that you need something already finished / adapted to your goal.
Have you the capacity to assemble a PCB having the components ?

About your timer project, I'm going to develop it because I can find an interest also for myself.
What is your objective? Program it using a mobile device or using a PC?
I was thinking about using a json structure containing all the programming.
The program will simply parse the json putting all the timing inside an array.
Then, each x seconds (60, for example), a timer will trigger a function that will enable/disable the outputs in line with the settings.
I was thinking about the possibility to use excel to define the timings generating the json file with a VBA macro.
Another possibility is to adapt my UDP debugger tool using it to program the timer.