choong ck

unread,
Jul 12, 2018, 2:57:13 AM7/12/18
to MIT App Inventor Forum

1. What is the expected response when the Web1.GotText event raised?

 

2. Can the below be the response?

"url:http://173.24.2.171,responseCode:200,responseType:text/plain,responseContent:GPIO is now high"

 

Best regards,

Chris Ward

unread,
Jul 12, 2018, 4:52:52 AM7/12/18
to MIT App Inventor Forum
Hello choong

In theory, yes. Is that a redirection response for an OAuth/OAuth2 login?

Why are you asking the question though? If you are having a problem, please describe the purpose of the app, the problem and post an image of your code blocks - then we potentially have something someone can help you with.


Abraham Getzler

unread,
Jul 12, 2018, 10:04:11 AM7/12/18
to MIT App Inventor Forum
I'm guessing from the 
responseContent:GPIO is now high"

that this is an IOT question.

ABG


 

choong ck

unread,
Jul 12, 2018, 7:33:57 PM7/12/18
to MIT App Inventor Forum

Hello Chris and fellow,

 

Attached is the screenshot of the code blocks using WebGotText event.

Attempt to simplify the code blocks.

 

From the previous email; “In theory, yes.” 

["url:http://173.24.2.171,responseCode:200,responseType:text/plain,responseContent:GPIO is now high"]

 

How to make this string of text an expected response when the Web1.GotText event raised?

 

Best regards,

MITapp.pdf

Chris Ward

unread,
Jul 13, 2018, 6:51:12 AM7/13/18
to MIT App Inventor Forum
Hello choong

ABG knows much more about this stuff than I do.

We need to know what it is that you are trying to do. It looks like you have an ESP8266/ESP32 WiFi micro controller or similar - possibly paired with an Arduino? Switching something on/off maybe an LED?

Please add your Arduino sketch to this post.

Not sure you actually need ["url:http://173.24.2.171,responseCode:200,responseType:text/plain,responseContent:GPIO is now high"] as an expected response, because App Inventor is extracting the important stuff for you. 

You can make that string a variable and compare the two, using label components, but it is possible that the response URL is encoded correctly, but differently. There is no point in applying programmatic comparison.








Compare_Response.aia

Abraham Getzler

unread,
Jul 13, 2018, 12:33:08 PM7/13/18
to MIT App Inventor Forum
How to make this string of text an expected response when the Web1.GotText event raised?

Which string?

Expected by who or what, in what context?

 ABG knows much more about this stuff than I do.

Still haven't mastered that mind-reading skill.

ABG

choong ck

unread,
Jul 13, 2018, 10:46:58 PM7/13/18
to MIT App Inventor Forum

Hello Chris and ABG,

 

Hi Chris,

Is there a detail explanation on how to use the component Web1.GotText, especially its expected response?

Try to get the component Web1.GotText communicate with other microcontroller and not only Arduino, through string of text.

 

Hi ABG,

1. Which string?

Below is the string of text. Am I wrong?

"url:http://173.24.2.171,responseCode:200,responseType:text/plain,responseContent:GPIO is now high"

 

2.Expected by who or what, in what context?

If the Web1.GotText wait for a response to arrive, then can the below be the response.

Chris Ward

unread,
Jul 14, 2018, 6:00:39 AM7/14/18
to MIT App Inventor Forum
Hi choong

There actually isn't a detailed description of .GotText:  http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Web

GotText(text url, number responseCode, text responseType, text responseContent)
Event indicating that a request has finished.

It's obvious what the url, responseCode and responseContent are but I do not know what the response type actually is, or for........ there certainly should be a detailed explanation, I will ask MIT to upgrade the Help (that's not going to happen overnight!).


Try to get the component Web1.GotText communicate with other microcontroller and not only Arduino, through string of text. 

That's cool, but evidently you have not been successful. So why not describe your hardware set-up, microcontroller make, model, version and post the script that sends-receives data to your App Inventor App? Then an expert here (not me!) will be able to help you.


If the Web1.GotText wait for a response to arrive, then can the below be the response.

"url:http://173.24.2.171,responseCode:200,responseType:text/plain,responseContent:GPIO is now high"

I think you are probably more right than wrong, but in your tests I presume it fails. Even if the syntax is correct, it might need to be URL encoded - but I don't know. Again, post your details and one of the experts here will no doubt relish the challenge. 



Abraham Getzler

unread,
Jul 15, 2018, 1:30:02 PM7/15/18
to MIT App Inventor Forum
Is there a detail explanation on how to use the component Web1.GotText, especially its expected response?

There are a bunch of samples of how to use Web blocks in the Web Services section of FAQ
(scroll all the way to near the bottom).

ABG
 

choong ck

unread,
Jul 15, 2018, 11:31:03 PM7/15/18
to MIT App Inventor Forum

Hello Chris and ABG,

 

Just an idea about this trivial experiment. Using MIT App Inventor and microcontroller/Arduino (attached to switch and LED) together. 

There is no coding on the microcontroller side and any setup yet. The reason is simple.

If one had to response to the Web1.GotText request, then the microcontroller/Aduino had to know the kind of response to the Web1.GotText.

 

Best regards,

Reply all
Reply to author
Forward
0 new messages