I am trying to implement the code found below and I keep getting the following error:
Arduino: 1.0.5 (Mac OS X), Board: "Arduino Diecimila or Duemilanove w/ ATmega168"
sketch_sep22a.ino: In function 'String whatup()':
sketch_sep22a:23: error: cannot convert 'String' to 'String*' in assignment
sketch_sep22a:25: error: conversion from 'String*' to non-scalar type 'String' requested
Could you help me understand why this is happening?
Thanks,
Victor
String fret[6] [4] = { {"G", "F#/Gb", "F", "E"},
{"C", "B", "A#/Bb", "A"},
{"F", "E", "D#/Eb", "D"},
{"A#/Bb", "A", "G#,Ab", "G"},
{"D", "C#/Db", "C", "B"},
{"G", "F#/Gb", "F", "E"} };
void loop () {
String one;
one = whatup(); //victor value is stored into one.
Serial.println(one); // should print memory location of fret [0] [2]
}
String whatup(){
String *victor; // Set up pointer
victor = fret [0] [2]; // Stores memory location
return victor; // return pointer
}
I am trying to implement the code found below and I keep getting the following error:
Arduino: 1.0.5 (Mac OS X), Board: "Arduino Diecimila or Duemilanove w/ ATmega168"
sketch_sep22a.ino: In function 'String whatup()':
sketch_sep22a:23: error: cannot convert 'String' to 'String*' in assignment
sketch_sep22a:25: error: conversion from 'String*' to non-scalar type 'String' requested
Could you help me understand why this is happening?
the error message says it all - your trying to return a String * and use it as a String - exactly what are you trying to achieve here? you've got some fundamental issues in the code based on what is written vs what is in the comments. do you want to show the string, or the address of the string?