Go Down

Topic: void value not ignored as it ought to be (Read 2 times) previous topic - next topic

PaulS

Quote
I would prefer to use pointers since speed is an issue

Pointers are not necessarily faster than other means of data access.

In this case, you would make some minor changes:
CapacitiveSensor *cs_sensor[numberOfSensors];
   
   for(int i = 0; i < numberOfSensors; i++)
   { // Down here where it belongs!
     cs_sensor = new CapacitiveSensor(capSenseSend,sensorPin);
   }

void setSensorValue()
{ // Down here where it belongs!
  for(int i = 0; i < numberOfSensors; i++)
  { // Down here where it belongs!
    letters.setCurrentReading(cs_sensor->capacitiveSensor(50)); 
  }
}

hilukasz


Quote
I would prefer to use pointers since speed is an issue

Pointers are not necessarily faster than other means of data access.

In this case, you would make some minor changes:
CapacitiveSensor *cs_sensor[numberOfSensors];
   
   for(int i = 0; i < numberOfSensors; i++)
   { // Down here where it belongs!
     cs_sensor = new CapacitiveSensor(capSenseSend,sensorPin);
   }

void setSensorValue()
{ // Down here where it belongs!
  for(int i = 0; i < numberOfSensors; i++)
  { // Down here where it belongs!
    letters.setCurrentReading(cs_sensor->capacitiveSensor(50)); 
  }
}


hmm this seems to throw an error that I can't find much info on: invalid conversion from 'const byte*' to 'uint8_t'
for the line cs_sensor = new CapacitiveSensor(capSenseSend,sensorPin);
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Delta_G

#17
Apr 06, 2013, 01:54 am Last Edit: Apr 06, 2013, 01:56 am by Delta_G Reason: 1
If Paul had that in code tags you'd see that there is a couple of array indexes there that aren't showing up.  Should look like:
Code: [Select]

for(int i = 0; i < numberOfSensors; i++)
  { // Down here where it belongs!
    cs_sensor[i] = new CapacitiveSensor(capSenseSend,sensorPin[i]);
  }



hilukasz


If Paul had that in code tags you'd see that there is a couple of array indexes there that aren't showing up.  Should look like:
Code: [Select]

for(int i = 0; i < numberOfSensors; i++)
   { // Down here where it belongs!
     cs_sensor[i] = new CapacitiveSensor(capSenseSend,sensorPin[i]);
   }





Yes, tried this too. same error.

also tried:
Code: [Select]
cs_sensor[i] = new CapacitiveSensor(capSenseSend,sensorPin[i]);

but this gave error:  request for member 'setCurrentReading' in 'letters', which is of non-class type 'Letter [2]'
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

PaulS

You need to post your current code, so that we can see that you made all the required changes, correctly. And so we can replicate (and solve) the problem more easily.

Go Up