Arduino and iOS: example code?

Rishi Rajalingham's Avatar

Rishi Rajalingham

25 Mar, 2019 01:51 PM

Hey Chris,
I'm looking to connect an ipad running MWorks iOS to a reward pump, via an arduino board. Can you point me towards example code that might do something like this? To clarify, the USB or BLE io-device must be connected to the server (the ipad), not the machine running the client.
Let me know, and thanks!
Rishi

  1. Support Staff 1 Posted by Christopher Sta... on 25 Mar, 2019 02:59 PM

    Christopher Stawarz's Avatar

    Hi Rishi,

    I'm looking to connect an ipad running MWorks iOS to a reward pump, via an arduino board. Can you point me towards example code that might do something like this?

    I've attached a short example experiment that demonstrates how to set this up on the MWorks side. It configures pin 13 on the Arduino (which is usually connected to a built-in LED) as a digital output line. Once the experiment is running, setting the variable pump_control_line to true or 1 should turn the LED on, and setting it false/0 should turn it off.

    On the Arduino side, you need to install the correct firmware. If you want to bring your board to my office, I can do this for you very easily. If you'd prefer to do it yourself, then

    1. If you haven't already, download and install the latest Arduino IDE.
    2. Download the latest version of the Arduino Firmata library, and install it in $HOME/Documents/Arduino/libraries.
    3. If you're using an Adafruit Feather M0 Bluefruit LE, download the latest version of the Adafruit_BluefruitLE_nRF51 library, and install in alongside the Firmata library.
    4. Open the Arudino IDE, and select File -> Examples -> Firmata -> StandardFirmataBLE.
    5. If you're using a Feather M0, in the window that opens, navigate to the tab containing the file bleConfig.h, and change the line

      //#define BLUEFRUIT_LE_SPI
      

      to

      #define BLUEFRUIT_LE_SPI
      

      (In other words, uncomment that line.)

    6. Select your board and port, and build and upload the example as per usual.

    Again, I can do this for you, if you prefer.

    To clarify, the USB or BLE io-device must be connected to the server (the ipad), not the machine running the client.

    Correct. FYI, USB is an option only on a Mac. BLE works with both Macs and iPads.

    Chris

  2. Christopher Stawarz closed this discussion on 02 Apr, 2019 07:26 PM.

  3. Christopher Stawarz re-opened this discussion on 26 Apr, 2019 03:22 PM

  4. Support Staff 2 Posted by Christopher Sta... on 26 Apr, 2019 03:26 PM

    Christopher Stawarz's Avatar

    Hi Rishi & Michael,

    FYI, I've written a more detailed guide on how to set up a Feather M0 Bluefruit LE. If you have any problems, please let me know.

    Chris

  5. Christopher Stawarz closed this discussion on 02 May, 2019 05:43 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac