element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Blog Arduino beginner
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Former Member
  • Date Created: 3 Nov 2013 8:48 PM Date Created
  • Views 1953 views
  • Likes 0 likes
  • Comments 11 comments
  • Math
  • help
  • arduino
  • advice
Related
Recommended

Arduino beginner

Former Member
Former Member
3 Nov 2013

I'm a complete beginner when it comes to electronics and programming, so I decided to help educate myself I would buy an Arduino starter kit. This kit arrived yesterday and came with an Arduino Project book which is jam packed with information and tutorials (great for learning and inspiration!!).

 

So far I have read the first few pages of the book and followed along with the first few examples. It's a lot of fun but I'm concerned about the mathematical aspect of electronics and programming (I skipped a few chapters to see what i would be doing and saw a few daunting parts that i could not get my head around). If any one has any advice for the Mathematical side I would be glad to hear from you in the comments section (i did not do very well at maths in school image but I don't want to give up) 

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 12 years ago in reply to kjhart0133 +1
    Erny Don't get too hung up on the maths. It wasn't my strong subject, but hasn't stopped me. There is certainly a time when you need to roll your sleeves up and get stuck in, but I sense you aren't there…
Parents
  • kjhart0133
    kjhart0133 over 12 years ago

    Erny,

     

    Can you post the code or a link to it.  It's hard to figure out what you need without seeing the code you're working with.

     

    Kevin H.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to kjhart0133

    const int sensorPin = A0;
    const float baselineTemp = 20.0;
    
    void setup(){
      Serial.begin(9600);
      for(int pinNumber = 2; pinNumber < 5; pinNumber++){
        pinMode(pinNumber, OUTPUT);
        digitalWrite(pinNumber, LOW);
      }
    }
    
    void loop(){
      int sensorVal = analogRead(sensorPin);
      Serial.print("Sensor value: ");
      Serial.print(sensorVal);
      float voltage = (sensorVal/1024.0) * 5.0;
      Serial.print(", Volts: ");
      Serial.print(voltage);
      float temperature = (voltage - .5) * 100;
      Serial.print(", degrees C: ");
      Serial.println(temperature);
      
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
    
      if(temperature >= baselineTemp + 2){
        digitalWrite(2, HIGH);
      }
      if(temperature >= baselineTemp + 4){
        digitalWrite(3, HIGH);
      }
      if(temperature >= baselineTemp + 6){
        digitalWrite(4, HIGH);
      }
      
      delay(1);
      
    }

     

    that's the code and I don't understand these parts:  float voltage = (sensorVal/1024.0) * 5.0;  float temperature = (voltage - .5) * 100;

      i mean i know what they are there to do but i don't quite understand the maths (i hope i make sense)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Former Member
    Former Member over 12 years ago in reply to kjhart0133

    const int sensorPin = A0;
    const float baselineTemp = 20.0;
    
    void setup(){
      Serial.begin(9600);
      for(int pinNumber = 2; pinNumber < 5; pinNumber++){
        pinMode(pinNumber, OUTPUT);
        digitalWrite(pinNumber, LOW);
      }
    }
    
    void loop(){
      int sensorVal = analogRead(sensorPin);
      Serial.print("Sensor value: ");
      Serial.print(sensorVal);
      float voltage = (sensorVal/1024.0) * 5.0;
      Serial.print(", Volts: ");
      Serial.print(voltage);
      float temperature = (voltage - .5) * 100;
      Serial.print(", degrees C: ");
      Serial.println(temperature);
      
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
    
      if(temperature >= baselineTemp + 2){
        digitalWrite(2, HIGH);
      }
      if(temperature >= baselineTemp + 4){
        digitalWrite(3, HIGH);
      }
      if(temperature >= baselineTemp + 6){
        digitalWrite(4, HIGH);
      }
      
      delay(1);
      
    }

     

    that's the code and I don't understand these parts:  float voltage = (sensorVal/1024.0) * 5.0;  float temperature = (voltage - .5) * 100;

      i mean i know what they are there to do but i don't quite understand the maths (i hope i make sense)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • mcb1
    mcb1 over 12 years ago in reply to Former Member

    Oops

    replying to the thread dumps it above the latest ....

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube