Hallo,
Ich versuche ein Array zu nutzen, wo jedes Element ein Pointer ist.
Wenn das geht:
#include <Wire.h>
#include <TLC59116.h>
TLC59116 board1(0);
int rp,gp,bp;
int i,*r=&rp,*g=&gp,*b=&bp;
void setup() {
*r=0;
*g=0;
*b=0;
for(i=9;i<=14;i++)
pinMode(i, INPUT);
attachInterrupt(digitalPinToInterrupt(9),tasted , RISING);// Rot-30
attachInterrupt(digitalPinToInterrupt(10),tastee , RISING);// Grün-30
attachInterrupt(digitalPinToInterrupt(11),tastef , RISING);// Blau-30
attachInterrupt(digitalPinToInterrupt(12),tasteg , RISING);// Rot+30
attachInterrupt(digitalPinToInterrupt(13),tasteh , RISING);// Grün+30
attachInterrupt(digitalPinToInterrupt(14),tastei , RISING);// Blau+30
board1.begin();
void loop() {
LED1 (*r,*g,*b);
}
void tasted(){
if (*r>=30)
*r-=30;
}
void tastee(){
if (*g>=30)
*g-=30;
}
void tastef(){
if (*b>=30)
*b-=30;
}
void tasteg(){
if (*r<=225)
*r+=30;
}
void tasteh(){
if (*g<=225)
*g+=30;
}
void tastei(){
if (*b<=225)
*b+=30;
}
void LED1 (int r,int g,int b){ //LED am TLC59116 ansteuern
board1.analogWrite(0,r);
board1.analogWrite(1,g);
board1.analogWrite(2,b);
}
warum geht dann nicht das:
#define RS232IN 201
byte inputp[RS232IN];
byte *input[RS232IN];
for (i=0;i<=RS232IN-1;i++)
input[i]=&inputp[i];
if (Serial.available()){
Serial.readBytes(*input, RS232IN);
for (i=0;i<=RS232IN-1;i++)
Serial.print(*input[i]);
Serial.println('fertig');
}
Ich möchte ein RS232 Signal mit 201 Bytes empfangen und Abspeichern, damit man von jeder Funktion beliebige Elemente verwenden kann:
if (*input[8]<=127)
digitalWrite(2,LOW);
else
digitalWrite(2,HIGH);
Wie geht es also?
Alles was ich bis jetzt gefunden habe war simpler oder zu komplex für so eine wie ich find leichte Problemstellung.