yun SPI problem


i have started play yun spi bus , not seem work @ all. have used spi loads of times , arduino spi code looks simple, change setting select pin 10 , standard spi functions.

i did have teensy board hook up, no scoping out pins , not seeing coming yun.


code: [select]


// inslude spi library:
#include <bridge.h>
#include <yunserver.h>
#include <yunclient.h>
#include <spi.h>

// set pin 10 slave select digital pot:
const int slaveselectpin = 10;

void setup() {
  // set slaveselectpin output:
  pinmode (slaveselectpin, output);
  // initialize spi:
  spi.begin();
}

void loop()
{

  do{
      digitalpotwrite(0x55, 0x55);
      delay(1000);
  }
  while(1);

}

void digitalpotwrite(int address, int value)
{
  // take ss pin low select chip:
  digitalwrite(slaveselectpin, low);
  //  send in address , value via spi:
  spi.transfer(address);
  spi.transfer(value);
  // take ss pin high de-select chip:
  digitalwrite(slaveselectpin, high);
}

try blink led inside digitalpotwrite function can see when enters in function. blink? (add delay if blinks fast)

also, pins change state when send data? try monitor teensy ss pin @ least.


Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > yun SPI problem


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code