Help for control of digital potentiometer

Hi to all,
i want to control digital potentiometer with android and my code is working on Arduino Uno and it is not working on Micro i know that micro has difrent pins for SPI, but i don’t know the right command for control it. This code is working on Uno i just need your help to change it for Micro. How i define slave pin on micro?. Thank you

#include "SPI.h"
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int ss=17; // using digital pin 10 for SPI slave select

void setup()
{
  Serial.begin(9600);
  meetAndroid.registerFunction(motor, 'o');
  pinMode(ss, OUTPUT); // we use this for SS pin
  SPI.begin(); // wake up the SPI bus.
  SPI.setBitOrder(MSBFIRST);
}
void setValue(int value)
{
  digitalWrite(ss, LOW);
  SPI.transfer(0); // send command byte
  SPI.transfer(value); // send value (0~255)
  digitalWrite(ss, HIGH);
}

void loop() 
{
  meetAndroid.receive();
}
void motor(byte flag, byte numOfValues)
{
  setValue(meetAndroid.getInt());
}

I have no idea what you mean by "micro" . Is that some other variety of Arduino ?

If it is some other kind of device completely, then I suggest you look for another forum. This is the arduino forum. We know how arduinos work, not "micros", whatever they are.

You might get lucky if someone else happens to know, but I would not count on it.

I mean Arduino Micro and it has different pins for SPI and i don't know how to solve it, i was locking on internet manuals but i don't understand jet so much and i just need that code will also work with Arduino Micro. I it has contacts for SPI on board and i connected it correctly i just need line of code to define SS pin and i don't know how. That code works on Arduino Uno.

int ss=17; // using digital pin 10 for SPI slave select

Since when is 17 equal to 10?

I was trying different pins because i don't know how to define pin SS.

Suko: I was trying different pins because i don't know how to define pin SS.

That's unfortunate, because [u]you[/u] need to define which pin you're using for SS. Do you understand how to use SPI?

Clearly, I think the thing to do is to throw the Android as far as possible. Then, program the Arduino to control the digital potentiometer. Only when that works should you go look for the Android and incorporate that in the sketch.

Also clear, to me at least, not all digital potentiometers are created equal. If you want help programming the one that you have, you need to tell us more about it. I'm relatively certain you didn't find it on the street, in a plain white box labeled "digital potentiometer". You must know something more about it.

michinyon: I have no idea what you mean by "micro" . Is that some other variety of Arduino ?

If it is some other kind of device completely, then I suggest you look for another forum. This is the arduino forum. We know how arduinos work, not "micros", whatever they are.

You might get lucky if someone else happens to know, but I would not count on it.

Perhaps: http://arduino.cc/en/Main/ArduinoBoardMicro

This is how i have connected Arduino micro and digital potentiometer MCP 4141.
Now i need to define SS pin in my code but i don’t know how. On code above i have ss = 17, all i need is how to define pin ss in my code.
Can you help me i know it is basic but iam stuck i tried everything but still i don’t know what i need to define pin ss.

wiring.jpg

The CS pin with the overline? That is the Chip Select pin. The line over it means that is normally HIGH, and you pull it LOW to perform its functionality.

The SDI/SDO pin means that the chip uses one pin as both input and output. SPI uses two separate pins. You can not use SPI to talk to this chip.

You might look at the OneWire library for some clues how to talk to that chip.

You could have gotten this information a lot sooner…