I am testing a set-up using the TinkerKit shield for Arduino Uno, and a few TinkerKit inputs and outputs. I have an issue with the code provided on the TinkerKit website for the potentiometer component:

#include <TinkerKit.h>

// creating the object 'pot' that belongs to the 'TKPotentiometer' class
TKPotentiometer pot(I0);

// creating the object 'led' that belongs to the 'TKLed' class 
TKLed led(O0);                              

int brightnessVal = 0;  // value read from the pot

void setup() {
  // initialize serial communications at 9600 bps

void loop() {
  // read the potentiometer's value:
  brightnessVal = pot.read();            

  // set the led brightness

  // print the results to the serial monitor:
  Serial.print("brightness = " );                      

  // wait 10 milliseconds before the next loop

I get an error message when compiling:

Class TKPotentiometer has no member named 'read'

According to this webpage, though, read should be a member of the class. Why am I receiving this message?


As soon as I finished writing the question, it came to my mind that perhaps I misspelled something, so I looked for a file in the Menu's sketchbook that I could load.

With my surprise, I found the same exact code as I posted, with a little difference:

pot.read() was substituted with pot.get()

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.