Code Help : error: void value not ignored as it ought to be

Hi All,

I need help with the below code. I’m very new to programming. Whenever I’m trying to compile the below code it is giving me below error. I’m not able to make anything from the error.
I’m trying to get the values of temperature and and trying to get average temperature value.

sketch_aug23b.ino: In function ‘void loop()’:
sketch_aug23b:64: error: void value not ignored as it ought to be
sketch_aug23b:64: error: void value not ignored as it ought to be
sketch_aug23b:65: error: void value not ignored as it ought to be
sketch_aug23b:65: error: void value not ignored as it ought to be

#include <UTFT.h>
#include <UTouch.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS_PIN 10
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
#define LARGE true
#define SMALL false

UTFT	myGLCD(ITDB32S,38,39,40,41);
UTouch	myTouch(6,5,4,3,2);

DeviceAddress Probe01 = { 0x28, 0x80, 0xAB, 0xAC, 0x04, 0x00, 0x00, 0x92 }; 
DeviceAddress Probe02 = { 0x28, 0x58, 0x68, 0xAC, 0x04, 0x00, 0x00, 0x9B };
DeviceAddress Probe03 = { 0x28, 0x32, 0x62, 0xAC, 0x04, 0x00, 0x00, 0x2A };
DeviceAddress Probe04 = { 0x28, 0x0E, 0x56, 0xAC, 0x04, 0x00, 0x00, 0x21 };
DeviceAddress Probe05 = { 0x28, 0xA1, 0xF9, 0xAB, 0x04, 0x00, 0x00, 0x83 };
DeviceAddress Probe06 = { 0x28, 0x29, 0xB3, 0xAC, 0x04, 0x00, 0x00, 0x1A }; 
DeviceAddress Probe07 = { 0x28, 0x15, 0xC8, 0xAC, 0x04, 0x00, 0x00, 0x97 };
DeviceAddress Probe08 = { 0x28, 0x5D, 0xF4, 0xAB, 0x04, 0x00, 0x00, 0x60 };
DeviceAddress Probe09 = { 0x28, 0x6B, 0x27, 0xAC, 0x04, 0x00, 0x00, 0xA9 };
DeviceAddress Probe10 = { 0x28, 0x2F, 0xBF, 0xAB, 0x04, 0x00, 0x00, 0x0F };

uint8_t *getProbReading[] = {Probe01, Probe02, Probe03, Probe04, Probe05, Probe06, Probe07, Probe08, Probe09, Probe10};
int screenno = 0;
void setup()   /****** SETUP: RUNS ONCE ******/
  int devCount = sensors.getDeviceCount();
  sensors.setResolution(Probe01, 10);
  sensors.setResolution(Probe02, 10);
  sensors.setResolution(Probe03, 10);
  sensors.setResolution(Probe04, 10);
  sensors.setResolution(Probe05, 10);
  sensors.setResolution(Probe06, 10);
  sensors.setResolution(Probe07, 10);
  sensors.setResolution(Probe08, 10);
  sensors.setResolution(Probe09, 10);
  sensors.setResolution(Probe10, 10);
}//--(end setup )---

void getTemprature(int a, int x, int y){
  int devCount;
	float i = sensors.getTempC(getProbReading[a]);
	myGLCD.printNumF( i, 1, x, y);


void getTemp(int a){
	float i = sensors.getTempC(getProbReading[a]);
void loop()
        float tempH = (getTemp(1) +  getTemp(2) + getTemp(3) + getTemp(4) + getTemp(5) + getTemp(6)/6); 
        float tempW = (getTemp(7) +  getTemp(8) + getTemp(9) + getTemp(10))/4; 

}//--(end main loop )---
void getTemp(int a)
(getTemp(1) +  getTemp(2)

You can't add the return values of a function that doesn't return anything.

getTemp does not return an value so you cannot add them

int getTemp(int sensorNumber)
  float temperature = sensors.getTempC(getProbReading[sensorNumber]);
  return temperature;

BTW the division by 6 is missing some () ...

Thanks Rob. It is working as I need.

Hi there,
I’m getting the same error with the following code.

I have a feeling it has to do with the line:

else move(1, 75, 0)&&move(2, 75, 1);    ////drive fwd

can I use move for both motors in an else if statement? If not, how could I move both motors for my robot? (i.e. to reverse or go forward)

Thanks in advance!

//motor A connected between A01 and A02
//motor B connected between B01 and B02

int STBY = 10; //standby

//Motor A
int PWMA = 3; //Speed control 
int AIN1 = 9; //Direction
int AIN2 = 8; //Direction

//Motor B
int PWMB = 5; //Speed control
int BIN1 = 11; //Direction
int BIN2 = 12; //Direction

// First the line following (IR) sensors
const int irLeft = 2; //Left line sensor is on pin A2
const int irRight = 3; //Right line sensor is on pin A3

//Here we set up variable that will hold the ADC value representing the line sensor values
int leftSees = 0; //A2 ADC value (0 to 1023)
int rightSees = 0; //A3 ADC value (0 to 1023)

void setup(){
  pinMode(STBY, OUTPUT);

  pinMode(PWMA, OUTPUT);
  pinMode(AIN1, OUTPUT); ///motor 1 - left side
  pinMode(AIN2, OUTPUT); 

  pinMode(PWMB, OUTPUT);
  pinMode(BIN1, OUTPUT); ///motor 2 - right side
  pinMode(BIN2, OUTPUT);

void loop(){
  //Start by reading the left sensor on A2
  int leftEye = analogRead(irLeft);

  //delay a little bit

  //next read the right sensor connected A3
  int rightEye = analogRead(irRight);

  //Next, we run the motors based on the sensor reading

  //If both sensors see black (ADC value greater than 1000), then back up
  if ((leftEye >= 1000)&&(rightEye >= 1000)) move(1, 75, 1)&&move(2, 75, 1);   ////reverse

  //Otherwise, if only the left sensor sees black, then turn off the left motor
  //so the robot veer to the left
  else if ((leftEye >= 1000)&&(rightEye < 1000)) move(2, 75, 0);    ////turn left

  //Otherwise, if only the right sensor sees black, then turn off the right motor
  //so the robot veer to the right
  else if ((leftEye < 1000)&&(rightEye >= 1000)) move(1, 75, 1);   ///turn right

  //Otherwise, move forward
  else move(1, 75, 0)&&move(2, 75, 1);    ////drive fwd


void move(int motor, int speed, int direction){
//Move specific motor at speed and direction
//motor: 0 for B 1 for A
//speed: 0 is off, and 255 is full speed
//direction: 0 clockwise, 1 counter-clockwise

  digitalWrite(STBY, HIGH); //disable standby

  boolean inPin1 = LOW;
  boolean inPin2 = HIGH;

  if(direction == 1){
    inPin1 = HIGH;
    inPin2 = LOW;

  if(motor == 1){
    digitalWrite(AIN1, inPin1);
    digitalWrite(AIN2, inPin2);
    analogWrite(PWMA, speed);
    digitalWrite(BIN1, inPin1);
    digitalWrite(BIN2, inPin2);
    analogWrite(PWMB, speed);

void stop(){
//enable standby  
  digitalWrite(STBY, LOW); 
move(1, 75, 0)&&move(2, 75, 1);

move does not return a result, so you cannot expect logical AND to work. What are you trying to do with that line of code?