2016년 11월 29일 화요일

How do it.. (for traffic lights)


How can I add blocks to get this: I want app will monitor the traffic lights (visually) and when the light changes eg from red to green, the play sounds. How should I go about? It is my second app so I'm very new! Please help me.

-- 
How are your traffic lights represented? How do you find out if they change?
Cheers, Ghica.

-- 
I have on my job the red and green light. when it switches so I would like to get the sound signal so I know when it's time to work, :) and I do not have to sit and stare at the lamp all the time. it is precisely the change of color is interesting from red to green. or red fails it will be the same thing, it will attract attention.

-- 
Are you sure you need an app for that?
In my town, the honking behind me tells me the light has changed.
ABG

-- 
Sorry Sebastian, your traffic light project is not practical using any reasonable methods.

1) How will the app determine the light has changed? 
 Do you expect the Camera to take a picture,save it, then compare the red amber or green pixels? You have to point the Camera, find a way to recognize it is 'looking at' a traffic signal, decide whether the signal is red or whatever.
Does the city provide a datastream showing the status of traffic signals?  Probably not.

2) If you app 'makes a mistake'  is it all right for the user to have an accident or cause a death?

It is a real neat concept, unfortunately AI2 and probably no Android can determine the status of the traffic light.

Perhaps someone has some ideas how this could work (other than the user looking at the light, deciding the color has changed, pressing a button to send a vocal message using TTS to say the light has changed and play sounds?   The sound playing is easy to program with AI2,  determining that the light actually changes is probably impossible.

Regards,
Steve

-- 
its not in traffic.. its on my job...

-- 
OK   ... then you might try to find an example from the MIT  Gallery of AI2 user provided examples.  See if someone has already made an app like you would like to make.

Search in the Gallery    using the term    time management        or    schedule    or   alarm  or perhaps   camera .  The examples might be what you want.  Find something interesting; download the aia and try the app, then modify it to do what you want perhaps?  You probably can think up other search terms.

How do you search the Gallery?    Load the AI2 browser.  then as shown below...


Or something similar.    You can use a Clock component to keep track of time.    There is no control to keep track whether a room perhaps is illuminated or dark.   You can set an alarm using a Clock component (in the Sensor drawer).

Using the camera to determine if an image is light or dark would probably be very complicated.   You could search a camera image for  light or dark pixels but if you use the camera, you will already know.  What you might do is use an arduino or other mini computer that has a light sensor and use that to determine if it is getting dark or bright and when the light level is at a certain level, to sound an alarm.

Good luck Sebastian.

-- 

I respectfully disagree with SteveJG.

As far as I understand this:
- point your phone at the traffic light, which is positioned on your workfloor somewhere for all workers to see.
- Let the camera of your phone monitor the traffic light, by taking pictures at regular intervals and interpreting them for change.
- If the light changes from red to green, speak a message: Go to work! or similar.
- If the light changes from green to red, speak a message: Coffee time! or similar.

This should be doable but not easy. And probably not very practical, because it would need
Start with a good understanding of AI, if needed look here: http://appinventor.mit.edu/explore/ai2/tutorials.html
Then, Taifun should be your best friend. He has extensions to make your life easier: http://puravidaapps.com/extensions.php
Maybe it is as simple as using this one: http://puravidaapps.com/image.php
This one: http://puravidaapps.com/snippets.php#2screenon
or maybe this extension: http://puravidaapps.com/file.php can help you to store a new and a previous camera image, or maybe just the file component is enough.
Maybe this tutorial can be of help: http://puravidaapps.com/file.php
And this: http://puravidaapps.com/snippets.php#2canvas
There are also some threads in this forum that talk about recognising shapes or colors in an image.

Now, would it be practical? The app should stay on the foreground (it needs to monitor the traffic light, right?), which means you cannot do anything else with your phone and it will drain your battery. So you really would need a dedicated phone for this, attached to a power supply.
Would it not be simpler to ask management to sound an alarm, in addition to switching the light?

Cheers, Ghica.


-- 

댓글 없음:

댓글 쓰기