Hello, I have solved your problem,
It was because there was lots of bad spaces Inside your code
For exemple at the end of this line : "void loop() { "
and at the begin of this line : " int numero;"
Moderador Traducción:
Hola, he resuelto su problema.
Se debe a que hay un montón de espacions malos en su código.
Por ejemplo, al final de la línea : void loop() {
y al comienzo de la linea : " int numero;"
//LED-5604 for Arduino
//GGB Madrid Spai
//oceam2@yahoo.com
//Corrected by Garoby Etienne
//SDI 11
//CLK 13
//Load 10
#include <SPI.h>
const int slaveSelectPin = 10;
const uint8_t num []={192,249,164,176,153,146,131,248,128,152};
int numero;
int millares;
int centenas;
int decenas;
int unidades;
void setup() {
// set the slaveSelectPin as an output:
pinMode(slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
}
void loop() {
numero++;
millares=numero/1000;
centenas=(numero-(millares*1000))/100;
decenas=(numero- (millares*1000 + centenas*100))/10;
unidades=numero-(millares*1000 + centenas*100 + decenas*10 );
digitalPotWrite(num[unidades]);
digitalPotWrite(num[decenas]);
digitalPotWrite(num[centenas]);
digitalPotWrite(num[millares]);
delay(1000);
}
void digitalPotWrite(int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin, LOW);
// send in the address and value via SPI:
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin, HIGH);
}
test-led-5604-arduino.ino (1.05 KB)