Logging output from multiple sensors

Supporting 10.7 and up
Fresh meat
Posts: 2
Joined: Wed Feb 08, 2012 7:21 pm

Logging output from multiple sensors

Postby Bridges4Shaler » Wed Feb 08, 2012 8:01 pm

I am am an AppleScript noob with very little other programing experience. I am trying to write a simple routine to log values from four Force Sensing Resistor sensors. I am working on some older equipment at school - MacOS 10.4.11, AppleScript 1.10.7, and an 8/8/8 PhidgietInterfaceKit. I have also installed Le Stang's script addition.

I can monitor the values manually by looking at the output in the Phidget control panel, but I would like to record the values and output them to a CSV file or other data spreadsheet. Ideally I would like to get multiple readings per second.

At the moment I can not even get a single value logged from one of my sensors. I have looked through several of the posts and have written the following script:

set theConnection to IKConnect
IKGetStatus theConnection
IKGetAnalogicInputsCount theConnection
IKGetVersion theConnection
set RawFSR_RF to IKRawReadAnalogicInput 0 kit theConnection
set RawFSR_RB to IKRawReadAnalogicInput 2 kit theConnection
set RawFSR_LF to IKRawReadAnalogicInput 4 kit theConnection
set RawFSR_LB to IKRawReadAnalogicInput 6 kit theConnection
log RawFSR_RF
log RawFSR_RB
log RawFSR_LF
log RawFSR_LB
IKDisconnect theConnection

I am not getting any results when I attempt to run this. Anyone with any ideas of why?

Does anyone have an example of a successful logging of sensor values over time done in Applescript they would be willing to share? An example of a working program would be a huge help. I am willing to change Languages, but I need something that is free. Thanks,


Posts: 28
Joined: Mon Oct 17, 2011 9:47 pm

Re: Logging output from multiple sensors

Postby Norm_L » Thu Feb 16, 2012 2:18 pm

Scap Led Stangs scripting addition and get the lastest Phidget 21 installer. It has it's own built in Applescript support. You can get your values 2 ways, run a script manually or run a script that loads handlers and then runs on it's own. Phidgets has some Applescript examples you can get from their Drivers page. You will see examples with and without Apple Events.

Return to “macOS”

Who is online

Users browsing this forum: No registered users and 1 guest