New multi version to test 1.43.4

Here you'll find the updated available
User avatar
PANNO
Posts: 114
Joined: Thu Feb 25, 2021 4:03 am
Has thanked: 121 times
Been thanked: 25 times

Re: New multi version to test 1.43.4

Post by PANNO »

Hi , ive tested udp between esp and a windows pc again. This time in booth direction.
It works .

Btw: how to use telegram now?
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: New multi version to test 1.43.4

Post by cicciocb »

The doc is not yet updated online but this is the extract :

TELEGRAM (messenger) support
Annex implements the direct support for the TELEGRAM messenger

Using these commands/functions it is possible to:

Send full text messages
Send html styled text messages
Get user Ident
Get text messages
Get text messages async
Send Images

For more information please refer to the official telegram API
https://core.telegram.org/bots/api

The commands are :
Set the Telegram Token ID
TELEGRAM.SetToken "token"

Set the operating mode
TELEGRAM.SetMode 0 'set the basic https communications (this is the default)
TELEGRAM.SetMode 1 'set the https communication using a certificate (internal)

Set the max time that the commands will wait for an answer from the telegram server
TELEGRAM.SetWait 10 ‘ set the max time at 10 seconds (the default is 10 seconds)

Receive incoming messages update in json format bui in async mode.
It uses the same event ONWGETASYNC used by the command WGETASYNC
TELEGRAM.getUpdatesAsync

The functions are :

A simple method for testing your bot's auth token. Returns basic information about the bot in form of a User object.
ret$ = TELEGRAM.getMe$

Send a text message. If the optional html is 1, the text can be formatted using some html tags
ret$ = TELEGRAM.sendMessage$( chat_id, "message" [, html] )
More informations here https://core.telegram.org/bots/api#html-style

Receive incoming messages update in json format
ret$ = TELEGRAM.getUpdates$

Send an image; the image can be in jpeg, bmp, gif or png format
ret$ = TELEGRAM.sendImage$( chat_id, image_path$)

Example of basic commands

Code: [Local Link Removed for Guests]

telegram.settoken "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
telegram.setwait 10
telegram.setmode 0

wlog telegram.getMe$ 'get the user’s informations
wlog telegram.getUpdates$ 'get the new messages

'Send a message to the chat_id 1234567890
wlog telegram.sendmessage$(1234567890, "Hello, world! " + str$(rnd(1000)))

'Send pictures from the disk to the chat_id 1234567890
wlog telegram.sendimage$(1234567890, "/images/sam.png")
wlog telegram.sendimage$(1234567890, "/images/poisson.bmp")

'Prepare an HTML formatted message
nl$ = chr$(10)
b$ = ||
b$ = b$ + |<b>bold</b>, <strong>bold</strong>| + nl$
b$ = b$ + |<i>italic</i>, <em>italic</em>| + nl$
b$ = b$ + |<u>underline</u>, <ins>underline</ins>| + nl$
b$ = b$ + |<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>| + nl$
b$ = b$ + |<b>bold <i>italic bold <s>italic bold strikethrough</s> <u>underline italic bold</u></i> bold</b>| + nl$
b$ = b$ + |<a href='http://www.example.com/'>inline URL</a>| + nl$
b$ = b$ + |<a href='tg://user?id=123456789'>inline mention of a user</a>| + nl$
b$ = b$ + |<code>inline fixed-width code</code>| + nl$
b$ = b$ + |<pre>pre-formatted fixed-width code block</pre>| + nl$
b$ = b$ + |<pre><code class='language-python'>pre-formatted fixed-width code block written in the Python programming language</code></pre>|

'Send the message in HTML format
wlog telegram.sendmessage$(1234567890, b$, 1)

end


Example of echo bot (reply the command received)

Code: [Local Link Removed for Guests]

telegram.settoken "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
telegram.setwait 10
telegram.setmode 0
 
onwgetasync asynco
'Get the update each 5 seconds
timer0 5000, getmessages
wait
 
getmessages:
telegram.GetUpdatesAsync 
return
 
'Receive the messages
asynco:
r$ = WGETRESULT$
wlog r$
text$ = json$(r$, "text")
if (text$ <> "not found") then
  c$ = json$(r$, "chat.id")   'get the chat_id
  wlog telegram.sendmessage$(val(c$), "echo : " + text$)
end if
return
bugs
Posts: 142
Joined: Mon Feb 08, 2021 10:10 pm
Location: Scotland
Has thanked: 44 times
Been thanked: 50 times

Re: New multi version to test 1.43.4

Post by bugs »

I tested the DAC - just for info - no complaints/queries :D

Code: [Local Link Removed for Guests]

CODE: xxxx.bas
--------------------------------------------------------------------------------

'ESP32 dac test
'dac pin 25 linked to adc pin 34
'dac pin 26 linked to adc pin 35

wlog "Val","DAC25", "DAC26","Diff"

for i=0 to 255 step 10
  pin.dac 25,i
  pause 10
  dac25=adc(34)
   
  pin.dac 26,i
  pause 10  
  dac26=adc(35)
 
  wlog i, dac25, dac26, dac26-dac25
next i

The wlog output :-
Val DAC25 DAC26 Diff
0 0 0 0
10 128 103 -25
20 282 253 -29
30 429 400 -29
40 587 560 -27
50 734 719 -15
60 887 864 -23
70 1037 1031 -6
80 1186 1178 -8
90 1344 1340 -4
100 1503 1488 -15
110 1660 1655 -5
120 1806 1808 2
130 1973 1968 -5
140 2131 2128 -3
150 2285 2281 -4
160 2431 2432 1
170 2590 2590 0
180 2739 2745 6
190 2897 2898 1
200 3041 3058 17
210 3218 3242 24
220 3408 3425 17
230 3631 3658 27
240 3877 3915 38
250 4095 4095 0
User avatar
PANNO
Posts: 114
Joined: Thu Feb 25, 2021 4:03 am
Has thanked: 121 times
Been thanked: 25 times

Re: New multi version to test 1.43.4

Post by PANNO »

Hi ,
I have tested the Telegram code . It works :mrgreen: . Thanks for implementing my Request.
Thanks again cicciocb.
efalken
Posts: 38
Joined: Tue Mar 02, 2021 3:47 pm
Has thanked: 17 times
Been thanked: 26 times

Re: New multi version to test 1.43.4

Post by efalken »

Hi cicciocb,
thanx so much for your work.
Is there a plan to implement telegram for esp8266 as well.
I prepared an accout there, but could not get your example to work on the esp8266..
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: New multi version to test 1.43.4

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Jul 22, 2021 1:50 pm Hi cicciocb,
thanx so much for your work.
Is there a plan to implement telegram for esp8266 as well.
I prepared an accout there, but could not get your example to work on the esp8266..
HI efalken,
no, I do not plan to include the support for the ESP8266, it does not has enough resources to support SSL.
efalken
Posts: 38
Joined: Tue Mar 02, 2021 3:47 pm
Has thanked: 17 times
Been thanked: 26 times

Re: New multi version to test 1.43.4

Post by efalken »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Jul 22, 2021 2:10 pm
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Jul 22, 2021 1:50 pm Hi cicciocb,
thanx so much for your work.
Is there a plan to implement telegram for esp8266 as well.
I prepared an accout there, but could not get your example to work on the esp8266..
HI efalken,
no, I do not plan to include the support for the ESP8266, it does not has enough resources to support SSL.
OK, thanx -reply in seconds!!!- so I'll go for a 32board for this...
gerdF
Posts: 10
Joined: Sun Mar 28, 2021 10:33 am
Has thanked: 6 times

Re: New multi version to test 1.43.4

Post by gerdF »

Hello everybody,
Up to Annex 1.43.3 everything worked fine under Windows 10.
But I have problems with the new 1.43.4 version.

pic1, I can't do anything with the errors
pic2, reading the ESP32-CAM module is obviously possible
pic3_flash, I can't do anything with
pic4_flashError

Ok, new functions, expanded scope, but does it have to be that complicated now?
I hope for help and thank you in advance

Gerd
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: New multi version to test 1.43.4

Post by cicciocb »

HI gerdF,
do not give up at the first try, maybe that the problem comes from your side :roll:

It looks that the toolkit is inside a "strange" folder name

Code: [Local Link Removed for Guests]

c:/-- ESP Annex WiFi RDS/Annex WiFi RDS 1.43.4
Try to use a folder name without '-' and spaces

Something like

Code: [Local Link Removed for Guests]

c:/ESP_Annex_WiFi_RDS/Annex_WiFi_RDS_1.43.4
and try again
gerdF
Posts: 10
Joined: Sun Mar 28, 2021 10:33 am
Has thanked: 6 times

Re: New multi version to test 1.43.4

Post by gerdF »

Hi cicciocb,
thanks for the quick answer and solution to my problem.
Chose a new short folder name, move files and compile without errors.
Thanks, now I can play with the new version and the new features.

Gerd
You do not have the required permissions to view the files attached to this post.
Post Reply