Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3432798
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:29:41+00:00 2026-05-18T07:29:41+00:00

I got a problem. I recently bought an Arduino Uno board. I tried to

  • 0

I got a problem. I recently bought an Arduino Uno board. I tried to make something funny like controlling an input from my computer. I used Python with pySerial and the program is the following:

arduino = serial.Serial(portaCOM, 9600, timeout = 1)
... in loop ->
arduino.write(value)


  def sliderUpdate(self, event):
        pos = self.slider.GetValue()
        arduino.write(pos)
        time.sleep(.1)
        print arduino.readline()

try:
    arduino = serial.Serial(portaCOM, 9600, timeout = 1)
except:
    print "Errore di connessione alla porta seriale"

The write value should send the value to my board though USB.
The program loaded on board is:

 const int ledPin = 11;
 byte brightness;

 void setup(){
     Serial.begin(9600);
     pinMode(ledPin, OUTPUT);
 }

 void loop(){
     while(Serial.available()){
         brightness = Serial.read();
         Serial.print(brightness);
         analogWrite(ledPin, brightness); //LED doesn't refresh the brightness
         delay(10);
     }
 }

My LED is working properly. I tried with the Fade example provided by Arduino and it’s working..

I checked if the program is sending properly the data. Yes, it is. It returns the same thing I sent before.

It should retrieve the value sent and set analaogWriter(pin, VALUE), but something is wrong or not working.

How can I fix this problem?

Solution

The Arduino code

const int ledPin = 11;
byte valoreLed;

void setup(){
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
}

void loop(){
    while(Serial.available()){
        valoreLed = Serial.read();
        analogWrite(ledPin, valoreLed);
        delay(20);
    }
}

Python script code:

pos = self.slider.GetValue()
arduino.write(chr(pos))

Thank you to everybody!! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:29:41+00:00Added an answer on May 18, 2026 at 7:29 am
    1. First of all, make sure your LED is properly connected. Anode (longer pin) to PWM 11 port and cathode (shorter pin) to ground, also you may need to add a resistor between cathode and ground depending on LED.
    2. Make sure you’re writing to the right port from python (that FTDI cable is associated with in your OS).
    3. If you’re not using FTDI cable with USB connector, make sure that all of the pins are connected to the right inputs.
    4. What is the value of value in your example? Try arduino.write(chr(0xFF)), does LED stay lit?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I've migrated from Wicket 1.4 to Wicket 1.5. I've got problem Panel with
I've got a problem about onbeforeunload recently that I need to pop up a
I have got a strange problem about in_array recently which I cannot understand. e.g.
Recently, I got into a problem with linking and VPATH with the side effect
I've got problem for my application. I want to start connectbot from my application
have a nice day. I got problem when trying to create an image from
I recently got some help on here from SLaks (thank you) on the behavior
I started playing with Racket pattern matching system recently and got into a problem
A problem I was working on recently got me to wishing that I could
Recently while I was working with CAS server,got a conceptual problem... As I understood

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.