Go Down

Topic: Python bridge connection refused (Read 115 times) previous topic - next topic

rock23

Hello any time i call Bridge.put or the Bridge.get method in my python code i keep getting a socket error code 146 connection refused i even get this error on bridge examples.Even calling Bridge.begin results in the same error.What would cause this?Thanks

tolis81

First initialize the Bridge library on the Arduino side

For example:

On the Arduino side:
Code: [Select]

#include <Bridge.h>

char D13value[2];

void setup() {
  pinMode(13, OUTPUT);
  Bridge.begin();
}

void loop() {
  Bridge.get("D13", D13value, 2);
  int D13int = atoi(D13value);
  digitalWrite(13, D13int);
  delay(100);
}


On the Linux side:
Code: [Select]

#!/usr/bin/env python2

import sys

sys.path.insert(0, '/usr/lib/python2.7/bridge/')

from bridgeclient import BridgeClient as bridgeclient

client = bridgeclient()
client.begin()

client.put('D13', '1')

Go Up