Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses

Electrical Measurements

Curriculum

  • 1 Section
  • 34 Lessons
  • Lifetime
Expand all sectionsCollapse all sections
  • Electrical Measurements
    34
    • 1.1
      Measure Voltage
    • 1.2
      Script and Tests
    • 1.3
      How it Works
    • 1.4
      Review and Practice
    • 1.5
      Solutions
    • 1.6
      Measure Resistance
    • 1.7
      Script and Tests
    • 1.8
      How it Works
    • 1.9
      Series vs. Parallel
    • 1.10
      Review and Practice
    • 1.11
      Solutions
    • 1.12
      Measurement Units
    • 1.13
      SI Units
    • 1.14
      Metric Prefixes
    • 1.15
      Convert Prefixes to Values
    • 1.16
      Prefix to Values Script and Tests
    • 1.17
      How the Prefix to Values Script Works
    • 1.18
      Convert Quantities to Values
    • 1.19
      How it Works
    • 1.20
      Script and Tests
    • 1.21
      Review and Practice
    • 1.22
      Solutions
    • 1.23
      Measure Current
    • 1.24
      Script and Tests
    • 1.25
      How it Works
    • 1.26
      Use Kirchoff’s Current Law
    • 1.27
      Review and Practice
    • 1.28
      Solutions
    • 1.29
      Ohm’s Law
    • 1.30
      Script and Tests
    • 1.31
      How it Works
    • 1.32
      Using Ohm’s Law
    • 1.33
      Review and Practice
    • 1.34
      Solutions

How it Works

How the Calculator Script Works

The script starts inside the while True loop, prompting you with “Enter volts: “.  The characters you type are stored in the text variable.  Then V = float(text) converts the characters you have typed from text into a floating point value and stores the result in a variable named V.  It repeats those steps for loading the ohms value you enter into the variable R.

while True:
    text = input("Enter volts: ")
    V = float(text)
    text = input("Enter ohms: ")
    R = float(text)   
 

 

Since V and R are known, the I = V / R form of the Ohm’s Law equation calculates the current value I.

   I = V / R    

 

After printing “I = “, the value of I, and the “A” unit, the script prints an empty line.  After that, the while True loop repeats so that you can calculate another current value.

   print("I = ", I, "A")
   print()    

 

Try This: Calculate V from A and Ω

Try modifying your script to calculate volts from amps and ohms.

  • Modify your script as shown below.
  • Update the name in the project name field to calculate_v_from_i_and_r.  Then , click Load/Save → Download Project Hex to save a copy of your work.
  • Click Send to micro:bit. 
  • Try entering some of the measurements you have taken previously into the serial monitor.
  • Verify that they match the calculated values.


Printer-friendly version
Script and Tests
Prev
Using Ohm’s Law
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2026 Parallax Learn • Built with GeneratePress