Skip to main content
added 437 characters in body
Source Link
Bachalo
  • 251
  • 4
  • 12

I have a raspberryPi and Arduino connected via i2C. On the RPi I have a python script that takes int values and simply sends them to the RPi, which in turn echoes them back. I am trying to debug this, since I am unable to send ints larger than 255.

One thought was that I might be able to connect the arduino slave directly to my Mac, and then use the Arduino serial monitor to help with debugging.

Unfortunately the python script will not run, because I assume i2C can only be run on a Linux kernel.

Am I mistaken?

This is an edited portion of my python code

import smbus
import time
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)

# This is the address we setup in the Arduino Program
address = 0x04

def writeNumber(value):
    bus.write_byte(address, value)
    return -1

def readNumber():
    number = bus.read_byte(address)
    return number

I have a raspberryPi and Arduino connected via i2C. On the RPi I have a python script that takes int values and simply sends them to the RPi, which in turn echoes them back. I am trying to debug this, since I am unable to send ints larger than 255.

One thought was that I might be able to connect the arduino slave directly to my Mac, and then use the Arduino serial monitor to help with debugging.

Unfortunately the python script will not run, because I assume i2C can only be run on a Linux kernel.

Am I mistaken?

I have a raspberryPi and Arduino connected via i2C. On the RPi I have a python script that takes int values and simply sends them to the RPi, which in turn echoes them back. I am trying to debug this, since I am unable to send ints larger than 255.

One thought was that I might be able to connect the arduino slave directly to my Mac, and then use the Arduino serial monitor to help with debugging.

Unfortunately the python script will not run, because I assume i2C can only be run on a Linux kernel.

Am I mistaken?

This is an edited portion of my python code

import smbus
import time
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)

# This is the address we setup in the Arduino Program
address = 0x04

def writeNumber(value):
    bus.write_byte(address, value)
    return -1

def readNumber():
    number = bus.read_byte(address)
    return number
Source Link
Bachalo
  • 251
  • 4
  • 12

Debugging i2C from Mac OSX desktop

I have a raspberryPi and Arduino connected via i2C. On the RPi I have a python script that takes int values and simply sends them to the RPi, which in turn echoes them back. I am trying to debug this, since I am unable to send ints larger than 255.

One thought was that I might be able to connect the arduino slave directly to my Mac, and then use the Arduino serial monitor to help with debugging.

Unfortunately the python script will not run, because I assume i2C can only be run on a Linux kernel.

Am I mistaken?