Indigo and Arduino

Posted on
Sat Nov 24, 2012 11:27 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Indigo and Arduino

Get the exact same results. The Arduino shows in both.

Thanks,

Carl

Posted on
Sun Nov 25, 2012 10:53 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Indigo and Arduino

Well, there goes that theory. Does the Serial method require an open before it can be used? (And a close after it is used.) I can't check on that at the moment, but I will check on the syntax later if you haven't found your answer.

Posted on
Sun Nov 25, 2012 10:57 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Indigo and Arduino

Try adding
text.open()
Before the write
And
text.close()
After

EDIT: Here is the complete (untested) scriptlet...
Code: Select all
text = serial.Serial(port='/dev/tty.usbmodemfd541', baudrate=9600)
text.open()
text.write('b')
text.close()


Take a look at http://pyserial.sourceforge.net/shortin ... rial-ports for more information on using pySerial

Posted on
Tue Nov 27, 2012 11:31 am
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Indigo and Arduino

Tried but no go, still same issue. I added the "import serial" line at the beginning, as the original had,
and it works just the same...the Arduino serial window has to be open to work.

Not a big deal at all. More a curiosity than anything else. This is a seasonal thing that I could easily
just leave Arduino running.

Thanks,

Carl

Posted on
Mon Mar 18, 2013 2:22 pm
mikeL offline
Posts: 46
Joined: Apr 30, 2010
Location: Gatineau, QC

Re: Indigo and Arduino

I have several Arduinos performing small tasks in my home automation system and I've had good results communicating with them through Indigo using ethernet. Communication is easy and has proved to be very reliable.

For example, I have two Arduino Uno R3s with Ethernet shields that I use to measure temperatures around my house. On each Uno, a digital input is connected to a string of one-wire temperature sensors and the ethernet shield is connected to a LAN port on my Apple Airport Extreme. (So, communication is over wi-fi and doesn't tie up any USB ports on my computer.) Each Arduino runs a simple ethernet server that I POST to using curl to get temperature readings. The curl command is executed periodically from an Applescript file called by an Indigo scheduled event. Here's the basic curl command executed from a bash terminal and the Arduino's response:

Code: Select all
Tenaga:~ mike$ curl arduino5/mtds -d curl=1
Sensor 1 : 16.7
Sensor 5 : 10.5
Sensor 6 : 8.1
OK
Tenaga:~ mike$


The IP address of this Arduino (arduino5) is listed in /etc/hosts along with my other Arduinos to simplify the curl call.
Code: Select all
Tenaga:~ mike$ cat /etc/hosts
##
# Host Database
#
...
10.0.1.177   arduino1
10.0.1.204   arduino4
10.0.1.215   arduino5


Since curl is a unix command it has to be used in a 'do shell script' command in Applescript. For example, in this code snippet, I'm retrieving temperature readings from a bunch of sensors then stuffing them into corresponding string and numeric Indigo variables:
Code: Select all
--Update MTDS variables
set physicalSensors to {"Basement", "Outside", "undefined", "undefined", "Garage", "Attic", "Office", "MasterBR"}
set wdsData to ""
try -- read data from MTDS devices
   set wdsData to (do shell script "curl arduino5/mtds -d curl=1")
end try
set nP to ((count of paragraphs in wdsData) as number) - 1
repeat while nP > 0
   set sensor to (word 2 of paragraph nP of wdsData) as integer
   set tNumber to ((word 3 of paragraph nP of wdsData) as number)
   if paragraph nP of wdsData contains "-" then -- tNumber should be negative
      set tNumber to (tNumber * (-1.0))
   end if
   set tString to ((tNumber as text) & "°")
   set varname1 to (item sensor of physicalSensors) & "_Temperature"
   set varname2 to "t" & (item sensor of physicalSensors)
   tell application "IndigoServer"
      set value of variable varname1 to tString
      set value of variable varname2 to tNumber
   end tell
   set nP to nP - 1
end repeat


The only issue I've had with Applescript in this case is when the temperature reading is negative, I need to modify the parsed value by multiplying it by -1.

If you're looking for some help with getting your Arduino to talk to Indigo, just let me know--I don't mind sharing my code.
Cheers,
Mike

Posted on
Mon May 13, 2013 10:35 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Indigo and Arduino

Mike,
would you be able to share the ethernet shield sketch you used? I would like to read the alarm system that is already build into my house. I have ordered a $11 Arduino ethernet shield (sainsmart on amazon- it takes 4 weeks to deliver though). It has 6 input analog ports. I would like to connect these ports the to incoming cables of the alarm system and share the status with the indigo system. The shield should fit into the alarm box and the router sits next to it.

Here the flow:
Old alarm system --> Ethernet shield --> MAC interface --> indigo --> send email if alarm condition and or switch on lights etc...

Thanks

Karl
.. my first post please be patient if I ask a dumb question.

Posted on
Sun May 19, 2013 1:51 pm
mikeL offline
Posts: 46
Joined: Apr 30, 2010
Location: Gatineau, QC

Re: Indigo and Arduino

Hey Karl, here's the Arduino sketch I use to build a webserver for my 1-wire temperature sensors. The sketch references an auxiliary file called tSensor.h that I can post in another reply if you want it. To save you some time trying to figure out what I have done, I'll attempt to explain my program.

The first group of #includes are the standard ones when using the Ethernet shield. tSensor specifies the structure of my sensors and the last two are needed for the 1-wire stuff. I use the same code for two Arduino boards (I have a lot of sensors) so I have some conditional code to select between the two (ARDUINO_UNIT_NO 4 or 5) to setup IP MAC number and IP address, and the names and addresses of the sensors attached to each Arduino.

The webserver provides some functions to allow my curl client running from an Indigo Applescript to interact with the application. The functions are defined in a switch statement; the switch is based on a parameter (mtdsFcn) posted by the curl client.

A word about the sensors. These are 1-wire devices that each have a unique address and all sit on the same bus. However, each sensor's address is initially unknown i.e., it is not documented and must be determined by the program. When the program starts up it configures the "known" sensors by reading their addresses and matching each address to the sensor information defined in the program. When I add a new sensor to the sensor bus its "unknown" address is reported on the serial terminal, allowing me to build up the known sensor information accordingly. So, lots of little adjustments to the sketch are needed initially to get several sensors on line.

The repetitive tasks (reading the sensors and computing averages, for example) are performed in the loop() function. Note that I am using a 'tick' concept to specify the timing of the tasks. Loop uses the Arduino timer to generate 200 ms ticks and ticks are counted (and managed) to regulate tasks over a 20-tick cycle. Tasks are performed at the beginning of specified ticks. This technique works very well! Note that the webserver is always available (and is managed completely by the WebServer.h library code.)

Let me know if you have any questions about the code. Good luck with your project.
Cheers,
Mike
Code: Select all
/*
 * MTDS_v2_1.ino
 * Mike Lussier - Jan 31, 2013
 * Compiled with Arduino 1.0.3
 *
 * This is version 2.1
 * Status: compiles, executes and works well with multiple sensors.
 *****************************************
 *   Uses serial monitor at 19200 baud to configure sensors     
 *****************************************
 * v2.1.x - Starting point is v2.0.
 *      - - -
 *     .3 - Recompiled with latest version of Arduino sdk 1.0.3. Size 25,746 bytes.
 */

#include "SPI.h"
#include "Ethernet.h"
#include "WebServer.h"
#include "tSensor.h"
#include <OneWire.h>
#include <DallasTemperature.h>

#define INO_NAME "MTDS"
#define INO_VERSION "2.1.3"
#define N_SENSORS 6  // Maximum number of sensors on this bus
///////////////////////////////////////////////////////////////////////////
#define ARDUINO_UNIT_NO 5      // Arduino unit number (4 or 5)            /
///////////////////////////////////////////////////////////////////////////

// URLs on this server will start with arduino.../mtds
#define PREFIX "/mtds"
// Create an instance of the webserver
WebServer webserver(PREFIX, 80);

// NVRAM storage
P(ack) = "OK";

// Digital pin assignments
#define ONE_WIRE_BUS 8         // 1-Wire data

#define TEMPERATURE_PRECISION 10  // Use 10-bit resolution for DS18B20s

// Setup a oneWire instance to communicate with OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass oneWire reference to the Dallas Temperature Library
DallasTemperature sensors(&oneWire);

// Allocate sensor data arrays
const short nSensors = N_SENSORS;
tSensor sensor[nSensors];

// Variables
int nDevices;          // Number of 1-wire devices found on bus
short nReadings = 0;   // Number of readings accumulated for averaging
DeviceAddress ithDeviceAddress; // Address of ith device
short mtdsFcn = 0;     // Web server function index
char cstat[80];        // Used to hold formatted text

// Constants
const short maxReadings = 5; // Number of temperature readings needed to compute average

// Global time vars
unsigned long t0 = 0, sec = 0;
int nticks = 0, hourNo = 0, dayNo = 0;

//******* Webserver Functions ********
void mtdsCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
  char ctime[10];
  bool curlClient = false;

  if (type == WebServer::POST)
  {
    bool repeat;
    char name[16], value[16];

    repeat = server.readPOSTparam(name, 16, value, 16);

    // curl client will use "curl" to prefix an mtds command
    if (strcmp(name, "curl") == 0) {
      curlClient = true;
      mtdsFcn = strtoul(value, NULL, 10);

      // Carry out mtds functions
      switch (mtdsFcn) {
      case 1: // Post current readings for all online sensors
        {
          postAll();
          // Post OK
          server.printP(ack);
          server.printCRLF();
          break;
        }
      case 0: // Post unit status and details
        {
          // Unit identity
          sprintf(cstat,"unit_no   : %d", ARDUINO_UNIT_NO);
          server.println(cstat);
          sprintf(cstat,"devices   : %d", nDevices);
          server.println(cstat);
          // Time counters
          sprintf(ctime,"days_up   : %d", dayNo);
          server.println(ctime);
          sprintf(ctime,"seconds   : %lu", sec);
          server.println(ctime);
          // Software details
          sprintf(cstat,"ino_name  : %s", INO_NAME);
          server.print(cstat);
          sprintf(cstat," %s", INO_VERSION);
          server.println(cstat);
          // Post OK
          server.printP(ack);
          server.printCRLF();
          break;
        }
      case 9: // Re-sync uptime (called by the Indigo scheduler at midnight)
        {
          if (hourNo >= 18) dayNo++;
          hourNo = 0;
          sec = 0;
          sprintf(cstat,"%s", "Synced.");
          server.println(cstat);
          // Post OK
          server.printP(ack);
          server.printCRLF();
          break;
        }   
      } // switch
    }
    return;
  } // if type is POST

  // For a HEAD or GET, send the standard "OK headers"
  server.httpSuccess();
} // mtdsCmd

//******* Sensor Functions ********
void configureSensors()
// Devices are mapped to sensors via their address
{
  // Assign default addresses (00-00-00-00-00-00-00-00)
  for (int j=0;j<nSensors;j++){
    for (int i=0;i<8;i++){
      sensor[j].add[i] = 0x00;
    }
  }

#if ARDUINO_UNIT_NO == 5
  // Logical Sensor1 28-C4-70-D7-03-00-00-53
  sensor[0].add[0]=0x28;
  sensor[0].add[1]=0xC4;
  sensor[0].add[2]=0x70;
  sensor[0].add[3]=0xD7;
  sensor[0].add[4]=0x03;
  sensor[0].add[5]=0x00;
  sensor[0].add[6]=0x00;
  sensor[0].add[7]=0x53;
 
  // Logical Sensor2 10-B8-A1-0A-02-08-00-81
  sensor[1].add[0]=0x10;
  sensor[1].add[1]=0xB8;
  sensor[1].add[2]=0xA1;
  sensor[1].add[3]=0x0A;
  sensor[1].add[4]=0x02;
  sensor[1].add[5]=0x08;
  sensor[1].add[6]=0x00;
  sensor[1].add[7]=0x81;

  // Logical Sensor3 - offline

  // Logical Sensor4 - offline

  // Logical Sensor5 28-27-9C-D7-03-00-00-D8
  sensor[4].add[0]=0x28;
  sensor[4].add[1]=0x27;
  sensor[4].add[2]=0x9C;
  sensor[4].add[3]=0xD7;
  sensor[4].add[4]=0x03;
  sensor[4].add[5]=0x00;
  sensor[4].add[6]=0x00;
  sensor[4].add[7]=0xD8;

  // Logical Sensor6 28-38-72-D7-03-00-00-DF
  sensor[5].add[0]=0x28;
  sensor[5].add[1]=0x38;
  sensor[5].add[2]=0x72;
  sensor[5].add[3]=0xD7;
  sensor[5].add[4]=0x03;
  sensor[5].add[5]=0x00;
  sensor[5].add[6]=0x00;
  sensor[5].add[7]=0xDF;

  // Logical Sensor7 - offline

  // Logical Sensor8 - offline
#endif

  // Physical to logical sensor names
#if ARDUINO_UNIT_NO == 5
  sprintf(sensor[0].nam,"%s","Sensor 1");
  sprintf(sensor[1].nam,"%s","Sensor 2");
  sprintf(sensor[2].nam,"%s","Sensor 3");
  sprintf(sensor[3].nam,"%s","Sensor 4");
  sprintf(sensor[4].nam,"%s","Sensor 5");
  sprintf(sensor[5].nam,"%s","Sensor 6");
  //sprintf(sensor[6].nam,"%s","Sensor 7");
  //sprintf(sensor[7].nam,"%s","Sensor 8");
#endif

  // Status (offline, online)
  // All offline by default; changed by setup()
  for (int k=0;k<nSensors;k++) sensor[k].sta = offline; 

  // Grab a count of devices on the wire
  nDevices = sensors.getDeviceCount();

  // Locate devices on the bus
  Serial.print("Locating devices...");

  Serial.print("found ");
  Serial.print(nDevices, DEC);
  if (nDevices == 1) Serial.println(" device on the 1-wire bus.");
  else Serial.println(" devices on the 1-wire bus.");

  // Report parasitic power requirements
  Serial.print("Parasitic power mode is ");
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");

  Serial.println();
  Serial.print("Arduino unit no: ");
  Serial.println(ARDUINO_UNIT_NO);

  // Loop through each device, print out address, matching logical sensor name,
  // temperature resolution
  for(int i=0;i<nDevices;i++)
  {
    Serial.println("---------------------------------------------------");
    // Search the wire for address of ith sensor
    if(sensors.getAddress(ithDeviceAddress, i))
    {
      Serial.print("Found device ");
      Serial.print(i, DEC);
      Serial.print(" of type ");
      if (ithDeviceAddress[0] == 0x10) Serial.print("DS18S20");
      else if (ithDeviceAddress[0] == 0x28) Serial.print("DS18B20");
      else Serial.print("UNKNOWN");     
      Serial.print(" with address ");
      printAddress(ithDeviceAddress);
      // Find matching sensor
      short ithSensor = getIndex(ithDeviceAddress);
      if (ithSensor >= 0) { 
        Serial.print(" - Mapped to ");
        Serial.println(sensor[ithSensor].nam);
        // Set sensor's dev attribute to device index
        sensor[ithSensor].dev = i;
        // Reset accumulator for sensor
        sensor[ithSensor].acc = 0.0;
        // Set sensor status to online
        sensor[ithSensor].sta = online; 
        Serial.print("Setting resolution to ");
        Serial.println(TEMPERATURE_PRECISION, DEC);

        // Set the resolution to TEMPERATURE_PRECISION bit
        sensors.setResolution(ithDeviceAddress, TEMPERATURE_PRECISION);

        Serial.print("Resolution actually set to ");
        Serial.println(sensors.getResolution(ithDeviceAddress), DEC);
      }
      else Serial.println(" - ERROR - Can't assign logical sensor!");
    }
    else {
      Serial.print("Found ghost device at ");
      Serial.print(i, DEC);
      Serial.print(" but could not detect address - check power and cabling.");
    }
  }
  Serial.println();
  Serial.println("Sensor configuration completed.");

} // configureSensors


short getIndex(DeviceAddress _deviceAddress)
// Return index of sensor whose address matches device address.
// Sensor and device addresses need to be compared byte by byte.
// Return -1 if no match is found.
{
  bool same;
  for (int j=0;j<nSensors;j++) {
    same = true;
    for (int i=0;i<8;i++) {
      if(_deviceAddress[i] != sensor[j].add[i]) {
        same = false;
        break;
      }
    }
    if (same) return j;
  }
  // Failed to find a matching sensor
  return -1;
} // getIndex


void printTemperature(DeviceAddress _deviceAddress)
// Print temperature data for specified device
{
  float tempC = sensors.getTempC(_deviceAddress);
  Serial.println(tempC, 2); 
} //printTemperature


void printAddress(DeviceAddress _deviceAddress)
// Print specified address
{
  for (uint8_t i = 0; i < 8; i++)
  {
    if (_deviceAddress[i] < 16) Serial.print("0");
    Serial.print(_deviceAddress[i], HEX);
  }
} //printAddress

void postReadings(short _sensorIndex)
// Posts data for specified sensor (if it's online)
{
  if (sensor[_sensorIndex].sta == online) {
    sprintf(cstat,"%s",sensor[_sensorIndex].nam);
    webserver.print(cstat);
    webserver.print(" : ");
    webserver.print(sensor[_sensorIndex].tav,1);
    webserver.printCRLF();
  }
} // postReadings


void postAll()
//
{
  for (int j=0;j<nSensors;j++) postReadings(j);
} //postAll


void requestReadSensors()
// Initiate read request for all sensors.
{
  // sensors.requestTemperatures() issues a global temperature
  // request to all sensors on the bus
  sensors.requestTemperatures();
  nReadings++;
  if (nReadings >= maxReadings) nReadings = 0;
} //requestReadSensors


void updateReadings()
// Loop through each device, updating accumulators of corresponding sensors.
// Calculate average temperatures when nReadings == 0.
{
  for(int i=0;i<nDevices;i++)
  {
    // Search the wire for address of ith device
    if(sensors.getAddress(ithDeviceAddress, i))
    {
      // Update accumulator of corresponding sensor
      short ithSensor = getIndex(ithDeviceAddress);
      if (ithSensor >= 0) {
        sensor[ithSensor].acc += sensors.getTempC(ithDeviceAddress);
        // Calculate average temperature
        if (nReadings == 0) {
          sensor[ithSensor].tav = sensor[ithSensor].acc / maxReadings;
          // Reset the accumulator
          sensor[ithSensor].acc = 0.0;
        }
      }
    }
  }
} // updateReadings


void tick()
// Perform scheduled tasks on 200 ms ticks over 4000 ms cycle (20 ticks)
{
  if (millis() - t0 >= 200) { // On 200 ms boundary
    t0 = millis();
    ++nticks;  // Increment tick count
    if (nticks > 19) nticks = 0;

    // Every 1000 ms
    if (nticks % 5 == 0) {
      //  - Increment seconds counter, manage hours & days counter
      ++sec;
      if ((sec % 3600) == 0) ++hourNo;
      if (hourNo == 24) {
        // Reset uptime counters
        hourNo = 0;
        sec = 0;
        dayNo++;
      }
    }

    // On 2 second tick
    if (nticks == 10) {
      requestReadSensors();
    }

    // On 4 second tick
    if (nticks == 0) {
      updateReadings();
    }

  }
} // tick



// ************************** Let the games begin *******************************
void setup(void)
{
  // Start serial port
  Serial.begin(19200);

  Serial.println(" ");
  Serial.println("*");
  Serial.println("*");
  Serial.print(INO_NAME);
  Serial.print(" ");
  Serial.println(INO_VERSION);
  Serial.println("*");

  // Start up the DTL
  sensors.begin();

  // Configure sensors
  configureSensors();

  Serial.end();

#if ARDUINO_UNIT_NO == 4 
  // MAC number and IP parameters for arduino4
  // arduino4 is defined in /etc/hosts as 10.0.1.204
  static uint8_t mac[] = {
    0xDE, 0xAD, 0xBE, 0xEF, 0x02, 0x04       };
  static uint8_t ip[] = {
    10, 0, 1, 204       };
#else
  // MAC number and IP parameters for arduino5
  // arduino5 is defined in /etc/hosts as 10.0.1.215
  static uint8_t mac[] = {
    0xDE, 0xAD, 0xBE, 0xEF, 0x02, 0x15       };
  static uint8_t ip[] = {
    10, 0, 1, 215       };
#endif

  // Initialize the Ethernet adapter
  Ethernet.begin(mac, ip);

  // Setup the default command that will run when the web client
  // (curl) accesses the root page on the webserver
  webserver.setDefaultCommand(&mtdsCmd);

  // Start the webserver
  webserver.begin();

  // Grab the current time
  t0 = millis();
} // setup


void loop(void)
{
  char buff[64];
  int len = 64;
  // process incoming connections one at a time, forever
  webserver.processConnection(buff, &len);

  // Perform scheduled tasks on 200 ms ticks
  tick();
} // loop

Posted on
Sun May 19, 2013 2:19 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Indigo and Arduino

thanks, although I will not be using the dallas wire system, I still can copy some of the code, thanks - I will post mine when I am done.
The alarm system read out challenge is due to the fact that some of the switches were combined as the system has only 8 inputs but there are 10+ doors/smoke detectors... to read . I will use some voltage divider setup to read analog voltages then make a decision in the sketch to determine which switch was opened / triggered.

Karl

Posted on
Tue May 21, 2013 1:27 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Indigo and Arduino

Mike,

Have the alarm system data in applescript (all 10 channels) seems to work,
(alarm system --> arduino--> wifi shield --> curl --> applescript

here my next question:
In "+ Trigger" I have to pick a device for the origin of the trigger
How do I define a device in indigo, that is not x10, insteon ... Do I have to add a plugin for other?


Thanks

Karl

ps just realized that we set variables not triggers
works now.

now have to make it nice and usable.

Posted on
Fri Nov 29, 2013 9:38 am
gg2 offline
Posts: 29
Joined: Apr 16, 2008

Re: Indigo and Arduino

This is a very nice implementation.

Do you know if an example of a Python script, similar to the AppleScript you kindly shared, is available?

This would be a Python script that issues a POST instruction to the arduino web server.

Yours, Rick

Posted on
Fri Nov 29, 2013 10:20 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: Indigo and Arduino

Sorry , no . this one is all applescript, works for about 6 months now. only problem was upgrade to mavericks when it rejected ALL applescripts.

When I have some time I might convert it to PY

I have one example in py that send commands to a web camera to set brightness levels.
you could easily use that to read an arduino.

Karl


Code: Select all
#!/usr/bin/env python
import urllib2
import sys

## wait until is finished

theIPnumber = '192.168.1.71'
Brightness= 1
Contrast= 1
Saturation= 1
Antiflicker= 1
MirrorOnOff= 0


map = ["1", "14", "26", "39", "51", "64", "77", "90", "103", "115", "128"]
   
     
if Brightness >= 5: Brightness = 5
if Brightness <= -5: Brightness = -5
setBrightness = map[(Brightness +5)]
   
if Contrast >= 5: Contrast = 5
if Contrast <= -5: Contrast = -5
setContrast = map[(Contrast +5)]
   
if Saturation >= 5: Saturation = 5
if Saturation <= -5: Saturation = -5
setSaturation = map[(Saturation +5)]
   
if Antiflicker >= 1: setAntiflicker = '1'
if Antiflicker <= 0: setAntiflicker = '0'
   
if MirrorOnOff >= 1: setMirrorOnOff = '1'
if MirrorOnOff <= 0: setMirrorOnOff = '0'


print setBrightness
   
cmd = "&ReplySuccessPage=image.htm"
cmd = cmd + "&ReplyErrorPage=errrimg.htm"
cmd = cmd +"&BrightnessControl="+ setBrightness
cmd = cmd +"&ContrastControl="+setContrast
cmd = cmd +"&SaturationControl="+setSaturation
cmd = cmd +"&AntiFlickerEnable="+setAntiflicker
cmd = cmd +"&Mirror="+setMirrorOnOff
cmd = cmd +"&ConfigSystemStream=Save"

print cmd

theURL = 'http://'+theIPnumber+'/setSystemStream'
theUserid="xxxx"
thePassword="yyyy"
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, theURL, theUserid, thePassword)
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passman)))
response = urllib2.urlopen(theURL,cmd)

Posted on
Sat Nov 30, 2013 11:25 pm
gg2 offline
Posts: 29
Joined: Apr 16, 2008

Re: Indigo and Arduino

Thanks. That helps. Much appreciated.
Rick

Posted on
Sun Dec 01, 2013 2:10 pm
gg2 offline
Posts: 29
Joined: Apr 16, 2008

Re: Indigo and Arduino

Did MikeL make the tSensor.h file available that goes along with the arduino server code example? Does anyone have it - and could post it?
Rick

Posted on
Tue Mar 18, 2014 3:16 pm
mikeL offline
Posts: 46
Joined: Apr 30, 2010
Location: Gatineau, QC

Re: Indigo and Arduino

Rick, are you still looking for the tSensor.h file? Sorry, I haven't been paying attention to this forum for a while so I missed your message until now. I'll post the file if you'd like.
Cheers,
Mike

Who is online

Users browsing this forum: No registered users and 5 guests

cron