If you want to connect some motor shields or sensors to Intel Edison you can do it by an extension board. But you’ll probably have to code a special libs for this. Instead of it you can connect an Arduino board to Intel Edisson and connect them though the UART interface.
First of all you have to switch SW1 on your Edison board to the second position. Connect 8(RX),9(RX), GND of the Arduino to 1(TX), 0(RX), GND of the Edison correspondingly.
Now you should set pins of the Edison as root:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# export all useful gpio echo 130 > /sys/class/gpio/export echo 248 > /sys/class/gpio/export echo 216 > /sys/class/gpio/export echo 131 > /sys/class/gpio/export echo 249 > /sys/class/gpio/export echo 217 > /sys/class/gpio/export echo 214 > /sys/class/gpio/export # Disable tri-state echo low > /sys/class/gpio/gpio214/direction # Set direction echo low > /sys/class/gpio/gpio248/direction echo high > /sys/class/gpio/gpio249/direction echo in > /sys/class/gpio/gpio216/direction echo in > /sys/class/gpio/gpio217/direction # Set Mode1 echo mode1 > /sys/kernel/debug/gpio_debug/gpio130/current_pinmux echo mode1 > /sys/kernel/debug/gpio_debug/gpio131/current_pinmux # Activate tri-state echo high > /sys/class/gpio/gpio214/direction |
If you’ve yielded the error like this:
1 2 |
echo high > /sys/class/gpio/gpio214/direction bash: /sys/class/gpio/gpio214/direction: No such file or directory. |
Write and upload the sketch to the Arduino Mega:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
void setup() { // initialize serial ports Serial.begin(9600); // USB serial port 0 Serial1.begin(9600); // serial port 3 } byte rx_byte = 0; // stores received byte void loop() { /* // check for data byte on USB serial port if (Serial.available()) { // get byte from USB serial port rx_byte = Serial.read(); // send byte to serial port 3 Serial1.write(rx_byte); } // check for data byte on serial port 3 if (Serial1.available()) { // get a byte from serial port 3 rx_byte = Serial1.read(); // send the byte to the USB serial port Serial.write(rx_byte);*/ //} Serial.print(millis()); Serial1.print(millis()); delay(1000); } |
1 2 |
stty -F /dev/ttyMFD1 9600 cat /dev/ttyMFD1 |