How to connect a mouse (and use it to capture GPS coordinates from your cell phone)?

Is it posible to conect a mouse to cell Phone so when its click GPS location is store?

probably a Bluetooth mouse could work Google Search

You want to use the Bluetooth mouse button to click a location on a Map to show the coordinates of the click in latitude and longitude and display it?

The following advice is NOT tested.

If you get the cell phone to respond to a mouse click; you might be able to use the Map component to capture the latitude and longitude from the Map component map with a Block like this to send the coordinates to a Label.

maptapatpoint . You might be able to use the mouse button to 'tap' on a location on a map. It would be simpler to not use themouse. Just use the block , a map and your finger to select the location :slightly_smiling_face:

1 Like

With a Bluetooth Mouse, it is possible that you could use either App Inventor's built-in Bluetooth or the BLE extension to communicate with it. I have never tried this but if you have the mouse you can experiment.

1 Like

Thanks Steve JG

i will try to set it up. while the actual idea is to use the mouse as a "Button" rather than as a pointer on a map. your approach is quite interesting.
I need to see if i can use a mouse as a "clicker" to record location, accuracy and time of event say the cellphone wil be in a backpack while mouse ring or clicker at hand when tap or click records location.

say a wireles mouse has a usb bluetooth that one should place at USB port so mose comunicates through it, no usb no recognition. I have so much to lear please send or share turtorials if you know of any.
best regards
LuisMa

Good luck. Be aware to use Bluetooth you have to have a WIFI or Data connection working. That might not be possible if your cell is in a backpack and may not be able to get satellite reception or a wifi or data connection :thinking: ..

Experiment. I have never tried this. I think it could work. Let us know what happens.

If you want to get very fancy with your project, you might find the information in this tutorial

useful to capture your location information to a database. The database could be the TinyDB (I did not make a version of this showing how to use a TinyDB to capture the information you want to save. It would work too.) It does not involve bluetooth.

Hi Steve
bought a bluetooth mouse and i have paried to my cellphone but not uning a MIT app invetor. I wat to use this gadget as a clicker event.
I have an app that register location of 12 diferent kind of events, sotores it and then sends it to GSS using a web app (still have issues with the accuracy recording).

I wish to provide the user with a clicker instead of using the cellphone screen. I have to learn on the Bluetooth properties would blocks (extensions) be needed for mouse usage? or an arduino extension may be needed.

the idea behind the app is to place items on a virtual world that (on the GSS) then some else could find using augmented reality app. like a tressure hunt or a game of clue...

thanks again LuisMa

What isGSS ?

Sorry. As I said earlier I don't know how to use the mouse buttons like a switch. One of the Bluetooth extensions should be able to do it. I have a bluetooth keyboard that works with my tablet by pairing. Sorry, I do not have the code.

Asking Google, I get this advice (which might work to use a mouse button as a 'switch'
In App Inventor, you can use the BluetoothClient component to connect to Bluetooth devices, including those that act as switches or mice, and then use the BluetoothClient.ReceiveText event to process data sent from them. [1, 2, 3]

Here's a breakdown of how to approach this:

  1. Setting up Bluetooth Communication: [2, 4]
  • Add the BluetoothClient Component: Drag the BluetoothClient component from the "Connectivity" palette into your App Inventor project. [2, 4]
  • Pairing and Connecting: Ensure the Bluetooth device (switch or mouse) is paired with your phone/device. You'll need to use the BluetoothClient.Connect block, and potentially a ListPicker to select the device from a list of available Bluetooth devices. [4, 5]
  • Data Transmission: Once connected, the Bluetooth device should send data to your App Inventor app. You can use the BluetoothClient.ReceiveText event to receive the data. [3]
  • Data Processing: In the BluetoothClient.ReceiveText event handler, you'll process the received data. This might involve parsing the data to determine the state of a switch or the position of a mouse. [3, 6]
  1. Handling Switch/Mouse Input: [3, 7]
  • For Switches: If the Bluetooth device is a switch, the data received might indicate whether the switch is ON or OFF. You can use this data to update a label, change the background color, or control other components in your app. [3, 7]
  • For Mice: If the Bluetooth device is a mouse, the data received might include x and y coordinates. You can use this data to move an image on the screen, control a game, or interact with other components. [6]
  1. Example Scenario (Switch): [3]
  • Receive Data: In the BluetoothClient.ReceiveText event, you might receive "ON" or "OFF". [3]
  • Update Label: Use the Label.Text block to update a label with the current state of the switch. [3, 7]
  • Control Components: Use the data to enable or disable other components, change colors, or trigger actions in your app. [3, 7]
  1. Example Scenario (Mouse): [6]
  • Receive Data: In the BluetoothClient.ReceiveText event, you might receive x and y coordinates.
  • Move Image: Use the Image.X and Image.Y blocks to move an image on the screen based on the received coordinates.
  • Interact with Components: Use the mouse coordinates to interact with other components, such as buttons or labels. [6]

Important Considerations: [3, 8]

  • Bluetooth Module: Make sure your Bluetooth module (switch or mouse) is configured to send data in a format that App Inventor can easily parse. [3, 8]
  • Delimiter: If you are sending multiple messages, you might need to use a delimiter (e.g., "\n") to separate them. [3, 9]
  • Error Handling: Add error handling to your app to gracefully handle situations where the Bluetooth connection is lost or the device is not responding. [10]
  • Testing: Test your app thoroughly to ensure that it correctly receives and processes data from the Bluetooth device. [11.)]

Generative AI is experimental.

[1] How to make the "Switch Button" to enable Phone's Bluetooth when toggled?

[2] Connectivity

[3] https://community.appinventor.mit.edu/t/receive-data-via-bluetooth/84104

[4] https://www.youtube.com/watch?v=w5LgLsCumFI

[5] https://www.youtube.com/watch?v=F9SzF3ktkIo

[6] How to connect a mouse (and use it to capture GPS coordinates from your cell phone)?

[7] Bluetooth and long press

[8] https://www.instructables.com/Build-a-Bluetooth-Robot-W-Arduino-MIT-App-Inventor/

[9] Bluetooth Connection in other screens

[10] Bluetooth connection button color

[11] https://appinventor.mit.edu/FAQ.)

I have not tried this. I do not have a bluetooth mouse. The first thing you need to do to build your app is get the mouse to exchange data with your cell phone. Then you possibly could work on your virtual world.

Hi Steve
thanks GSS Google Spread Sheet.
I will use my Saturday to learn on the subjects you sent,and try to solve my current accuracy recording and transmision issues
thanks again LuisMa