Forum - MCS Electronics

Author Message
Duval JP

Joined: 22 Jun 2004
Posts: 1019
Location: France

 Posted: Fri Dec 18, 2020 12:07 pm    Post subject: Analogic Clcok with the gauges of nextion HMI Hi This video shows the interest of using the "intelligent" Nextion . the gauges have the possibility to be transparent, i.e. the hand is displayed but not the background. This considerably reduces the number of programme lines. Moreover I used the internal RTC which frees an I2C port. Again this is possible only with the "intelligente Nextion display [img][/img] Video here : https://youtu.be/rZ9rJepxNWU code here : JP _________________pleasure to learn, to teach, to create
albertsm

Joined: 09 Apr 2004
Posts: 5319
Location: Holland

 Posted: Fri Dec 18, 2020 9:19 pm    Post subject: thank you for sharing JP. Time is going fast in the video It looks smooth. In 2021 i will check out nextion too._________________Mark
Duval JP

Joined: 22 Jun 2004
Posts: 1019
Location: France

Posted: Sun Dec 20, 2020 2:25 pm    Post subject: a little bug

the intervals are sometimes difficult to handle. it's just arithmetic and I made a little mistake that my 9 year old granddaughter won't forgive me. the correct sub in nextiontimedate.inc for hour is:
 Code: '---------------------------------------------------------------------------------------- Sub Gaugehour()                                             'pour calculer l'angle de la gauge minutes en fonctions des minutes    Local Fxmin As Word    Local Fxhour As Word   Fxhour = Jhour    Select Case Fxhour        Case 0 To 8        Fxhour = Fxhour * 30 : Fxhour = Fxhour + 90       Case 9 To 12          Fxhour = Fxhour -9 : Fxhour = Fxhour * 30          'sans les minutes       Case 13 To 20           Fxhour = Fxhour - 12           Fxhour = Fxhour * 30            Fxhour = Fxhour + 90                             'sans les minutes           Case 21 To 23           Fxhour = Fxhour - 21 : Fxhour = Fxhour * 30    End Select    Fxmin = Jminute : Fxmin = Fxmin \ 2                      'on ajoute le décalage des minutes ,    ' 60 minutes de décallage dans l'heure  pleine pour 30 degrés Donc division entière des minutes    ' Et Incément Toutes Les 2 Minutes.    Fxhour = Fxhour + Fxmin   Call Nex_gaugeval( "z1" , Fxhour) End Sub

_________________
pleasure to learn, to teach, to create
Duval JP

Joined: 22 Jun 2004
Posts: 1019
Location: France

Posted: Sun Dec 27, 2020 6:44 pm    Post subject: letter weighing with a HX711

I have added a letter weighing function to my clock.
I was helped by Mikael from the Bascom.de forum. You can see the software I used as an inspiration.
many thanks to him for this very simple way to do

I use a DFROBOT SEN160 1Kg module from GoTronic to do it
the Video :
https://youtu.be/-D6NelyDm-U

the code :
I remark the dim because they are put in the main program.

 Code: ''HX711 weight---------------------------------------------- Sub Hx711() 'HX711 Wägezellen-Sensor michael@bascomforum.de    Call Nex_page(2)                                         'give here the name of the weight page==============    Waitms 100 'Dim Wert As Long                                            'Wandlerwert        Converter value        Valeur du convertisseur 'Dim C As Byte At Wert Overlay                            'serielles Byte LSB 'Dim B As Byte At Wert + 1 Overlay 'Dim A As Byte At Wert + 2 Overlay                           'serielles Byte MSB 'Dim X As Byte At Wert + 3 Overlay                           'MSB im Long 'Dim Tara As Long                                            'Offset 'Dim Wert_final As Long                                      'Rechnungsvariable 'Const Faktor = 1989    Clock Alias Portc.5                                         ' the clock    Config Clock = Output    D_in Alias Pinc.4                                        ' data in    Config D_in = Input    Tara = 0    Do       For Ibyte = 7 To 0 Step -1          Clock = 1          Waitus 2          A.ibyte = D_in          Waitus 1          Clock = 0       Next       If A.7 = 1 Then          X = 255       Else          X = 0       End If       For Ibyte = 7 To 0 Step -1          Clock = 1          Waitus 2          B.ibyte = D_in          Waitus 1          Clock = 0       Next       For Ibyte = 7 To 0 Step -1          Clock = 1          Waitus 2          C.ibyte = D_in          Waitus 1          Clock = 0       Next       Clock = 1                                                '25 Clocks       Waitus 2       Waitus 1       Clock = 0       Waitms 20       Device_id = 0       Call Nex_returntime()       Select Case Device_id          Case 1                                             'tare             Tara = Wert             Debug #usb , "tare:" ; Wert             Device_id = 0             Wait 1            Case 2                                           'retour              Exit Sub       End Select       Waitms 200       If Tara = 0 Then Call Nex_text( "t3" , "Zero ?" , Black , White , 4)       Call Weighing()    Loop End Sub Sub Weighing()    If Tara > 0 Then       Wert = Wert - Tara                                    'Offset abziehen    'deduct offset (tare) , soustraire le décalage    End If    If Tara = 0 Then       Call Nex_text( "t3" , "Zero ?" , Black , White , 4)        Debug #usb , "mesure vide " ; Wert       Exit Sub    End If   Wert_final = Wert / Faktor                                'Faktor für metrische Gramm   Factor for metric grams        ' facteur pour les grammes    Wert_final = Abs(wert_final)    Debug #usb , "Wert_final " ; Wert_final    Sentence = Str(wert_final) : Sentence = Sentence + " g"    Call Nex_text( "t3" , Sentence , Black , White , 4)    Device_id = 0 End Sub

_________________
pleasure to learn, to teach, to create

Last edited by Duval JP on Mon Dec 28, 2020 10:56 am; edited 1 time in total
albertsm

Joined: 09 Apr 2004
Posts: 5319
Location: Holland

 Posted: Mon Dec 28, 2020 10:53 am    Post subject: hi JP thanks for the video and this addition. it seems to be very accurate. Ha Michael , he can do about anything with bascom _________________Mark
Duval JP

Joined: 22 Jun 2004
Posts: 1019
Location: France

 Posted: Mon Dec 28, 2020 11:01 am    Post subject: yes that right . Mikael use overlay and with this sample I understand overlay with the MSB and LSB JP_________________pleasure to learn, to teach, to create
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 Hour Page 1 of 1

 Jump to: Select a forum BASCOM AVR/8051----------------BASCOM-AVRBASCOM-8051BASCOM-ARDUINOShare your working BASCOM-8051 code hereShare your working BASCOM-AVR code hereBASCOM BETA-SLA BASCOM Related----------------EASY TCP/IPAVR-DOSAR7212KokkeKat FAT-free SD card libBASCOM Project Blog Other Stuff----------------VariousPCB'sRoboticsNew WebSiteAnnouncementsAVR Archive----------------BASCOM-AVR ArchiveBASCOM-8051 ArchiveBASCOM-AVR Unsupported versionsEasy TCP/IP ArchiveBASCOM-EDB
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum