Skip to first unread message

lecalou60

unread,
Dec 25, 2016, 3:40:05 AM12/25/16
to MIT App Inventor Forum

Hello Taifun,

I'm new to the world of MIT App Inventor. I use your "Taifun Wifi" extension in my small application. 
Your extension works great. Thank you so much. I have a simple question. I use two screens. 
One for the application and the second for the connection parameters or I use "Taifun Wifi". 
Here's my problem: how to send a number from 1 to 60 using wifi. 

For the bluetooth there is the instruction "Call ClientBluetooth SendText" but not for "Taifun Wifi". 
How to do? It must be a silly question for you but I'm starting. 

Thank you in advance for your help.

Cordiaally

Lecalou60

Ghica

unread,
Dec 25, 2016, 8:20:43 AM12/25/16
to MIT App Inventor Forum
The Wifi extension made by Taifun is not a Wifi equivalent of the Bluetooth client. It is there to find out some characteristicas of the Wifi network your phone is connected to. It does not support a communication protocol.

The first question i have: where do you want to send the numbers 1 - 60 to?
An Arduino board with Wifi shield, or another phone, or a PC, or??
Cheers, Ghica.

lecalou60

unread,
Dec 25, 2016, 9:30:40 PM12/25/16
to mitappinv...@googlegroups.com
Hello Ghica,
Thank you for your interest in my problem. 

I dialogue with a Wifi module from Roving Network (Microchip RN171XV). I just have to transmit a series of numbers from 1 to 60 to a Microchip 18F4685 microprocessor on which the Wifi module (serial bus of the microcontroller) is connected. 
For my tests I use the program "RN Wifi" of Roving Network to send my numbers to the module wifi. 
All this works very well and this allowed me to finish my program listed Microchip. 
Now I have to finish my program on the Android side (MIT App Inventor) and that's where I need your help. 
In my program, I just have to transmit 2 characters (01, 02, 03, .......... 59, 60). 
That's why I was talking about bluetooth and this function "Call ClientBluetooth SendText".
Today, I can see the wifi networks available and choose the one that interests me.

I can attach the MIT app inventor that I created.
Do not hesitate to ask me questions

cordially

Lecalou60

Ghica

unread,
Dec 26, 2016, 4:49:06 AM12/26/16
to MIT App Inventor Forum
Hi,
I removed your .apk
It is against forum guidelines to post an .apk, you may post an .aia however.

What you should try to do, is to communicate with your chip via a webbrowser on your PC. When you made sure that this works, you can write your app more easily.

Assuming your chip is similar to the ESP8266 Wifi, you could search this forum and find some examples that may help you.
Cheers, Ghica.

lecalou60

unread,
Dec 26, 2016, 9:14:41 AM12/26/16
to MIT App Inventor Forum
Hello Ghica,
Excused me for apk file post, i did not know.
I attach the file aie.

An example is enough for me to understand the method of sending.
Can you change my program so that I understand?

Thank you in advance.

cordially

Lecalou60
ArtLedDesignV1_2.aia

Ghica

unread,
Dec 26, 2016, 4:20:36 PM12/26/16
to MIT App Inventor Forum

Hi lecalou60,
No, I cannot change your code to make it work, because some essential information is missing. For example, what is the URL you want to send your data to? And how does your chip expect the data to be formatted?

Here is a simple example that I found that may help you further:
https://petestechprojects.wordpress.com/2015/01/06/appinventor2-web-interface-trial/

In addition, it would be very wise to learn a bit more about app inventor before you proceed:
Taifun's top 5 tips to learn AI2
http://puravidaapps.com/learn.php

I am saying this because there are some strange things in your code, like the picture above. This procedure will always return false, because a Web component can never be equal to a TinyWebDB component and that is what you are testing with the = comparison block.
What are you trying to do here?

Cheers, Ghica.

lecalou60

unread,
Dec 27, 2016, 1:13:27 PM12/27/16
to MIT App Inventor Forum
Hello Ghica,
I'm going to Peter's website.
I use its program PutText and PostText. It works in half.

Let me explain. I connect to my module RN171-Xv well, I can send the text "PutText".

The second time I want to transmit it, I have an error "Error 1103: Unable to post or put the text" PutText "with the specified URL: HTTP://192.168.0.69:2000"

If I use the Roving Wifly software that is used to test the program of my peak, I can still send text without having to modify the wifi module.

Would it not lack a controlling character to be transmitted just after the digit or letter?

How to add a control character to each sends with MIT App Inventor.

I think we are ready for the goal. Thanks for your help.

Thanks in advance. And very good holidays of end of year

Lecalou60

lecalou60

unread,
Dec 27, 2016, 1:18:07 PM12/27/16
to MIT App Inventor Forum
Hello Ghica,

I modified and simplified my program.
I had done many tests that clogged the program.
I use the features explained on the site to Peter.

Ghica

unread,
Dec 27, 2016, 4:40:08 PM12/27/16
to MIT App Inventor Forum
If your module needs a controlling character then you need to send one. Is it a line end? Or what is it?
Cheers, Ghica

lecalou60

unread,
Dec 28, 2016, 5:25:10 AM12/28/16
to MIT App Inventor Forum
Hello Ghica,

For control characters, this is a finding between MIT and Roving Wifi.
I put you 2 screenshots to be as clear as possible.

Capture 1:


It is with the program of Peter "PutText PostText"
I have the same result with my program. It is clear that the cursor remains right behind the text.

Capture 2:



It's with the Roving Wifi program.
I sent a "1" then the text "PutText"
This time though, the cure is two lines down and at the beginning of the line.

So I think we need to add CR LF to each transmission.
What should I add in my MIT program to send these two control characters to the end of each text send?

What function should I use to add the two control characters?



thanks for your help

Happy Birthday

Lecalou60

lecalou60

unread,
Dec 28, 2016, 5:29:39 AM12/28/16
to MIT App Inventor Forum
Hello Ghica,

it's a capture.

Lecalou60
Capture 1.png
Capture 2.png

Abraham Getzler

unread,
Dec 28, 2016, 10:43:02 AM12/28/16
to MIT App Inventor Forum
So I think we need to add CR LF to each transmission.

To get a CRLF sequence, see this Gallery sample:

ABG

lecalou60

unread,
Dec 28, 2016, 12:22:17 PM12/28/16
to MIT App Inventor Forum
Hello ABG,
I am brand new in the MIT world. I discover this software and all these functions.
I thank you for these examples that I will try to understand.
I think I saw one that corresponds exactly to my problem.

Good parties of New Year.

cordially

Lecalou

Constantin Teodorescu

unread,
Dec 29, 2016, 2:23:20 AM12/29/16
to MIT App Inventor Forum
For POST or PUT commands, set the Web component Request Headers to a list of lists, one of them including "Connection" "close"
See the attachment!
It will work every time!


Teo

lecalou60

unread,
Dec 29, 2016, 6:00:00 AM12/29/16
to MIT App Inventor Forum
Hello Ghica, ABG and Constantin

I move slowly. I managed to send the control characters to each send sequence. The cursor is in the same condition as with the Roving Wifi software.

But that did not solve my problem.

At the second sends I always my error:
"Error 1103: Unable to post or put the text" with the specified URL: HTTP://192.168.0.69:2000 "

Here is an overview of the MAI2 sequence.



Here is the result.



Constantin, how do I add your sequence in my code?
I do not understand everything. Can I put it in a procedure?

I would never thank you enough for your precious help.

Good parties of New Year.

cordially

Lecalou60
Message has been deleted

lecalou60

unread,
Dec 29, 2016, 6:36:19 AM12/29/16
to MIT App Inventor Forum
Hello Ghica, ABG and Constantin

I move slowly. I managed to send the control characters to each send sequence. The cursor is in the same condition as with the Roving Wifi software.

But that did not solve my problem.

At the second sends I always my error:
"Error 1103: Unable to post or put the text" with the specified URL: HTTP://192.168.0.69:2000 "

lecalou60

unread,
Dec 29, 2016, 6:40:16 AM12/29/16
to MIT App Inventor Forum
Hello Ghica, ABG, Constantin
Capt1.tiff
Capt2.tiff

Abraham Getzler

unread,
Dec 29, 2016, 10:59:38 AM12/29/16
to MIT App Inventor Forum
Regarding the 1103 error, look for the 1103 error comment in this thread for  possible explanation:

IP addresses starting with 192.168 are local, but once you pull in extra network connections
via mobile phone networking, local WiFi, and the AI2 Companion, addresses can change.

Also, why do you need to obfuscate the IP address?
How secret does a local IP address need to be?

ABG

Constantin Teodorescu

unread,
Dec 29, 2016, 11:39:45 AM12/29/16
to MIT App Inventor Forum
I discovered through multiple tests, and proved to be right, that RequestHeader "Connection: close" is the right solution for some Android versions.
It works 100% of the time, otherwise only the "odd" POST's are working, the "even" ones fail.

It's no need to obfuscate the url, I just took the example from an application where I needed to hide the URL (mine was a public url) in the apk, just to be sure.
I know that it's not a "professional grade" method but I just needed to hide my http endpoint. :-)

Teo

lecalou60

unread,
Dec 29, 2016, 12:13:59 PM12/29/16
to MIT App Inventor Forum
Hello ABG, TEO

Actually I do not need to hide the local IP address. This is an example that Teo sent me.
I try all possible solutions but I still have error 1103.
This works only once and after the second sends I have this error.

Being new on MAI2 I do not yet understand all the finesse of this programming.

At the start of my project, I opted for this module (RN171-XV) for the simplicity of the system commands. I programmed the Microchip 18F4685 and was able to test it with Roving Wifi software and a development kit (RN-XU-EK.

All the commands I send are well recognized by the microprocessor.

I just have to imitate Roving Wifi with MAI2.

I had asked the sources at Microchip / Roving for the example of their Roving Wifi but that was not possible. Pity. They sell a product without an example. It's strong!

If I do not find a solution, I will be forced to take an ESP8266 which is commented with examples for MAI2.

For now I continue with the RN171-XV

Teo, I changed HTTP to http, but it still does not work.

In my module, I put a fixed IP address at 192.168.0.69: 2000.

I think there is an error in my program because when I send a data, an orange LED flashes on module RN171.

When there is error 1103 the LED no longer flashes which means no transmission from the tablet to module RN171.

I'm going to the site in Petes.
I read what he was saying about error 1103. But my module is on the same Wifi network as my home router.
And the module works perfectly with the Roving Wifi software that is installed on my Samsung tablet.
I switch from one to the other, and when I have error 1103 on MAI2, I can still continue to send values with Roving Wifi without touching any parameters on the RN171.

We will find. I do not despair. Thank you for your help.
I enclose my MAY2 code.
If you have an idea?

cordially

Lecalou60
ArtLedDesignV1_2.aia

lecalou60

unread,
Dec 29, 2016, 12:23:31 PM12/29/16
to MIT App Inventor Forum
Hello ABG, TEO

For now I just test with the "Manual / Auto"

cordially

Lecalou60

Abraham Getzler

unread,
Dec 29, 2016, 1:01:29 PM12/29/16
to MIT App Inventor Forum
Just to cover all the bases, are you sure your home network is in the range 192.168.0.xxx ?
Some home routers are based at 192.168.1.1 by default.

An easy test for this is to point your web browser at 192.168.0.1 to look for a router signon page.
ABG

lecalou60

unread,
Dec 29, 2016, 5:45:19 PM12/29/16
to MIT App Inventor Forum
Hello ABG,
I just grab the IP 192.168.0.100 and I come across my box "Freebox" and all these settings. I can see all my connected network device.
We also see the module RN171- (Wifly EZX)


cordially

Lecalou60
Réseau.tiff

Ghica

unread,
Dec 30, 2016, 4:49:01 PM12/30/16
to MIT App Inventor Forum
Maybe it is time to take a step back.
You have learned a lot about App Inventor, but we do not understand enough about what your app is going to do.
You wrote earlier:

>>>
I dialogue with a Wifi module from Roving Network (Microchip RN171XV). I just have to transmit a series of numbers from 1 to 60 to a Microchip 18F4685 microprocessor on which the Wifi module (serial bus of the microcontroller) is connected. 
For my tests I use the program "RN Wifi" of Roving Network to send my numbers to the module wifi.
<<<

So, here is something to spend the rest of the year with:
1. What exactly is this Roving Wifi program: is it an app on your phone, or is it a kind of PC terminal program?
2. What exactly should you send to your app on the microchip and what does it reply when it receives a message?
3. Does your program on the microchip indeed need control characters, and if yes, why is it other than a simple \n?
4. Do you know what the HTTP messages should look like? Is it indeed a PUT text, or maybe a POST text?
5. Did you try Constantin's suggestion?

If you know exactly what you should send top your microchip, then we can suggest how that can be done using App Inventor.
For now, we seem to shoot in the dark and that is not very effective.
Best wishes for 2017, Ghica.


lecalou60

unread,
Dec 31, 2016, 1:48:45 AM12/31/16
to MIT App Inventor Forum

Hello Ghica,

I will try to be clearer. I wrote a program for the Microchip 18F4685.

This one controls LED lighting. I have 42 commands that arrives on the serial bus of the peak on which is plugged the module Wifi RN171-XV. 

I test the characters that happen on the serial bus. I verify that they are between 01 and 60 (01, 02, ...., 40, ..., 50, ... 60).


Each character corresponds to a function.

01 Enable Wifi 

51 Disabled Wifi

02 Manual 

52 Auto

05 Program 1

24 Program 20

30 to 40 Speed ​​/ Brightness

Etc ...

The program works perfectly with the Roving Wifly software available for free at Play Store (Android) and Apple Store (MacOS).


So I was able to validate my application on the microprocessor.


I still have to realize the Android interface. This is what I do with my MAI2 application.

The GUI is finished, I still have to write the code. If you watched my application, you can see the number that I should send in wifi. Any function on MAI2 except the transmission of this value. This is the last thing I have to do.


My module is connected in USB on my computer and I can see thanks to Coolterm the data that arrive on the COM port.


On my Samsung tablet I installed the Roving Wifly program which allows me to send the characters. For programming the microprocessor, I use Flowcode and ISIS which simulates in real time my electronic card. Flowcode generates a HEX file that is read by ISIS in real time.


Everything works perfectly if I use Roving Wifly on the tablet.


As soon as I am in MAI2 on tablet, only the first two character sends works. It is to the second that I have the error 1103.


The settings of the wifi module are ok because as soon as I switch back on the Roving Wifly software, it works.


So it is in the connection to the module with MAI2 that I have the problem.

I do not know in what mode the Roving software connects.


All I can see is that as soon as I chose the Wifi RN171-XV module with the Roving Wifly software, the green LED flashes completely and I receive:


* Open * Hello


On the other hand, with the application MAI2, when I send my two characters (Example: 52), the green LED lights up completely and I receive:


PUT / HTTP / 1.1

Connection: Close

User-Agent: Dalik / 1.6.0 (LINUX; Android 4.1.2; GT-P5110 Build / JZ054K)

Host: 192.168.0.69:2000

Accept-Encoding: gzip

Content-Type: application / x-www-form-urlencoded

Content-Length: 4


52


I will try to know in which mode the wifi module passes at the time of the connections.


As you can see on my previous messages, I test each time all the solutions that are proposed to me.

Is there not another way to transmit characters without going through the http?


Best wishes for 2017, Lecalou60


lecalou60

unread,
Dec 31, 2016, 2:00:31 AM12/31/16
to MIT App Inventor Forum
Ghica,

Here is the documentation for the RN171-XV module
rn-wiflycr-ug-v1.2r.pdf

Ghica

unread,
Dec 31, 2016, 9:25:15 AM12/31/16
to MIT App Inventor Forum
I will look at it again next year. For now I have other things to do.
I think that if you are using Wifi, you also need to use HTTP.
Cheers, Ghica.


Ghica

unread,
Dec 31, 2016, 9:27:47 AM12/31/16
to MIT App Inventor Forum
Could you also post your latest .aia?

lecalou60

unread,
Jan 1, 2017, 1:19:37 AM1/1/17
to MIT App Inventor Forum
Ghica,

I just made a conclusive test. I have installed the TCP Telnet Terminal program downloaded from the play store.
I just set it 192.168.0.69 and port 2000.
I successfully connected to module RN171 and was able to send characters without problems.

How can we do the same thing in MAI2?
This is my last question for this year. Hi!

Happy New Year 2017.

Lecalou60

Ghica

unread,
Jan 1, 2017, 8:51:59 AM1/1/17
to MIT App Inventor Forum
Maybe I caught the goose in this wild goose chase.
What you are trying to do is sending TCP messages, but with the AI web component you can send only HTTP messages.
You can read about the difference here, for example:
http://www.differencebetween.net/technology/internet/difference-between-tcp-and-http/

You can do 2 things:
Make your hardware understand HTTP,
or: use a TCP extension for AI. There is one mentioned in this thread:
https://groups.google.com/forum/#!category-topic/mitappinventortest/app-inventor-extensions/OCzEZC4FpEU

Happy 2017, Ghica.

lecalou60

unread,
Jan 1, 2017, 10:07:30 AM1/1/17
to MIT App Inventor Forum
Hello Ghica,

I hope you had a good holiday.
I wish you all the best for this new year.
And it starts well since the client_socket works perfectly.
Thank you so much. I can finally finish my application.

And good year also to all those who helped me in my quest.
Happy New Year to ABG, Teo
You are a great team.
Really great. You are fantastic.

And still good year 2017

Lecalou60

Ghica

unread,
Jan 2, 2017, 7:44:09 AM1/2/17
to MIT App Inventor Forum
Nice to hear! Cheers, Ghica
Reply all
Reply to author
Forward
0 new messages