• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

AttributeError: 'tuple' object has no attribute 'value'

Q&A Forum › Category: ESP32 › AttributeError: 'tuple' object has no attribute 'value'
0 Vote Up Vote Down
pacoalp asked 3 years ago

Hello, I hope you are well.
please can you help me
I have this error when I try to run
1 from machine import Pin
–
–
5 led=(2,Pin.OUT)
–
–
19 led.value(1)
Traceback (most recent call last):
File “<stdin>”, line 19, in <module>
AttributeError: ‘tuple’ object has no attribute ‘value’
Thank you for all your support and shared knowledge.

5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Your definition is wrong.
It should be:

led = Pin(5, Pin.OUT)

Regards,
Sara

0 Vote Up Vote Down
pacoalp answered 3 years ago

Hi.
1, 5 and 19  are  numbers of the line.
Or, I can´t use the number 2 in the definition?
Thank you

0 Vote Up Vote Down
pacoalp answered 3 years ago

I did it this way, and it worked:
import machine
led = machine.Pin(2, machine.Pin.OUT)
Thank you.

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Yes.
Or you can use:

from machine import Pin
led = Pin(5, Pin.OUT)

 
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
pacoalp answered 3 years ago

Your work is very valuable
Thank you.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.