Home‎ > ‎CS 11M‎ > ‎

Introduction to CS-11M

Introduction to C/C++ Programming Using Microcontrollers

The presentation slides are here.

Why Study Computing and Computer Science?

  • Congratulations!
  • You are making a smart decision to take a course in computer science
  • Here are some good reasons why:

Pebble prototype

Computing Enhances Your Creativity

  • Computer science gives you the power to be creative in the digital world
  • Why merely create a FaceBook page when you can create the next FaceBook?
  • By creating programs you can improve your life by putting better ideas into practice using the power of computers
  • Here is an example of someone who successfully pursued his passion by using an Arduino and C/C++

Pebble Watch Prototyped using Arduino and C/C++

  • Eric Migicovsky developed his prototype watch with an Arduino and C/C++ (source: Reddit post)
  • To fund the product, he launched a Kickstarter project on 4/10/12
  • Raised $1 million in 28 hours and $10,266,845 total
  • Where will you take the Arduino and C/C++ programming?

Computing Empowers You to do Good

  • Computers are a tool to help solve problems
  • With computers, you can connect technology to your community and make a world of difference, like:
    • Improving the environment by monitoring and reducing energy consumption and pollution
    • Improving health care and reducing medical costs
    • For example, we can develop mHealth or eHealth applications to help low-income people resolve health problems
  • David Patterson in a New York Times article said:
    "Computer scientists may have the best skills to fight cancer in the next decade"
  • Also, computers give us new ways to learn things, some of which you will experience in this course

Computing Opens Doors

  • There are about two billion personal computers in use (source: WikiAnswers.com, Worldometers)
  • In addition, there are many billions more computers embedded in everything from cell phones to car engines, iPods and video games
  • Because the number of computers is growing so fast, few careers are as rewarding as computing
  • Computer science pays well with average starting salaries of $66,801 for new grads in 2014 vs. $48,127 for the average College Graduate (source: NACE)
  • Computers are used in every industry, making computing an important skill in any career
  • What majors are students in this class pursuing?

Coding = Your New Superpower

More Information

    What is Computer Science and Programming?

    Computer Science: the study of the principles and uses of computers.

    • Sometimes Computer Science is equated to computers or computer programming
    • However, Computer Science is no more about computers or programming than astronomy is about telescopes or biology is about microscopes
    • Science is not about tools, but how we use them and what we find out when we do
    • Computer Science studies how to efficiently organize, store, retrieve and process data
    • Like biologists use microscopes, we use computers and programs to develop our understanding of Computer Science

    Phonebook Example

    • As an example of retrieving data, consider how to find a number in a phone book for a given name
    • One way is to start at the beginning and look at each name until we find the one we want
      • Usually takes a long time
    • However, the data in a phone book has a special property -- it is organized alphabetically
    • We can use this property to quickly find the page we want
    • How would we describe this process?
    • We start in the middle of the book, like with the letter M
    • Noting that P (for Parrish) comes after M, we disregard all the pages before M
      • This reduces the remaining number of pages by half
    • We repeat this process for the remaining pages, discarding half the pages with each step
    • Quite soon, we find the page we need
    • If the phone book is 1000 pages, then we might need 10 steps at most
    • What if the problem were expanded so we had 4 billion pages (about what a web search engine looks at), how many steps would we need?
    • Not as many as you may think -- only about 32 steps
    • To make fast searches, we have to organize the data and come up with an efficient algorithm

    Counting People

    • Suppose we want to know how many people are in a room like this
    • We could count each person one at a time
    • If there are n people, we need to make the count n times
    • How could we halve the number of steps?
    • Here is a possibly better algorithm:
      1. Stand up and think to yourself, "I am #1"
      2. Pair off with someone standing, add your number to theirs and take the sum as your new number
      3. One of you sit down and the other goes to step 2
    • Theoretically, this only takes log₂(n + 1) steps, a much faster approach
    • Let us try this approach and see if it works

    More Information

    Examples of What You Will Learn

    • As we study computing, we will work with cool technology and solve some interesting problems
    • Let us take a look at some examples of what you will learn in this course
    Arduino kit

    Arduino recommended kit

    Electronic Components


    • Programming LED circuits
    • Sensing the world digitally
      • Light
      • Pressure
      • Temperature
      • Sound
    • Movement in the physical world
      • Motors
      • Servos
      • Robots

    Programming languages and C++

    • There are many programming languages for computers
    • In this course we learn how to program using C++
    • C++ is one of the most popular programming languages
    • It is used in many problem domains including Engineering and game programming
    • Examples of programs written in C++ include:
    • Arduino uses C/C++ to control circuits

    More Information

    Exercise 1: Introductions and Questions

    Use the next 10 minutes to complete the following.

    1. Join a group of 3-4 people and introduce yourself to each other.
    2. As a group, develop one "burning question" about the course.
    3. Write the single question on the board.
    4. Select one member from your group as a spokesperson to describe your single question to the class.

    Exploring the Course

    How to be Successful in the Course

    Even Einstein Had to Try

    Even Einstein had to work to learn!

    • Each of us has the capability to learn the material of this course
    • To learn you need to take an active part in the learning process
    • As an active learner, you take responsibility for your own learning
    • As the instructor, I present ideas and examples
    • As the learner, you will need to work with the ideas to truly learn them
    • You must learn the material to pass the course

    Optimizing Your Learning

    1. Go to class and participate.

      Turn off your cell phones and pay attention to the lecture and participate in the activities. Ask questions in class. Establish good rapport with your classmates and the instructor. Get to know other students in the class during activities and breaks.

    2. Take notes and study them.

      Take notes during the lecture. Do NOT copy information verbatim; instead, jot down information that seems important or helpful in understanding the material. Read over your notes once or twice a week to reinforce what you learn. If something in the lecture or textbook does not make sense to you, ask the instructor to explain. The instructor wants you to succeed!

    3. Use your computer only during specified times and for specified tasks

      When using a computer do not become distracted or try to multitask. Students who take notes on a computer do worse on exams than those who take notes on paper. Also, students who multitask during a lecture score lower on exams than those who do not multitask. In addition, peers around the multitasker also do worse.

    4. Complete all your homework on time.

      Take responsibility for your learning and do your own homework. Remember Einstein's quote, "Genius is 1% inspiration and 99% perspiration." Expect assignments to take time to complete, so start working on them long before they are due.

    5. When you are stuck, don't give up!

      Programming is frustrating at times. Even professional programmers get stuck. Have confidence that you will find the solution to your problem. If you find you are stuck, take a break and come back to it later, talk to the professor, or ask a classmate for help.

    6. Study for tests effectively.

      Take the quizzes and exams seriously and prepare. Don't wait until the night before to study! Prepare practice problems and test yourself. Review homework problems, and use the example problems in the textbook to help prepare for quizzes and test.

    Information + Practice are like Yin and Yang

    Information + Practice

    Information + Practice = Expertise

    • Information + practice are like yin and yang
    • Information comes from instruction, reading, preparing for tests
    • Practice comes from exercises, labs, projects
    • Competence and mastery only comes from both information and practice.

    More Information

    Useful Information and Course Resources

    • We provide you with a lot of information and resources for you to succeed in the course
    • Here are some of the highlights

    Using the Course Website

    Using Classroom Computers

    • Login with a generic student login and password
      • Username: student
      • Password: Cabri11o (a.k.a. funny Cabrillo)
    • All contents of C:\ will be lost when you log out
    • The contents of D:\ are preserved
      • The D:\ drive is shared by everyone
      • Don't delete other people's stuff
      • Don't leave anything there that's precious!
    • You need your login and password to access Blackboard and some lab computers
    • See: How To Get Your Personal Cabrillo Login and Password:


    • Please make sure your email address is correct in WebAdvisor
    • When sending me an email please state your name and course number
      • I really do not know who you are from an email address like: fandango246@hotmail.com
    • Please make sure your emails are professional, that words are spelled correctly and that you use good grammar

    Keeping In Touch

    Employers always ask for new employees to have strong communication skills. This course uses a mailing list so that you can contact the instructors and ask each other questions. There are some important rules for the mailing list. 
    • Use the mailing list to discuss course material. 
      • Ask questions about assignments
      • Ask the instructors questions related to the course
      • Share interesting coding examples
    • DO NOT
      • Share solutions to labs and assignments
      • Talk about non class topics
    The class mailing list is anonymous. Other students will not be able to see your email address, but the instructors will! Sign your email with your name so people know who you are. Before you send any mail be sure you've read the email policy: 
    You should have received a welcome email from the mailing list. You have been subscribed with the password that WebAdvisor has. If anyone wants to subscribe with a different email address tell me ASAP. 
    Join the Group 
    The CS and CIS departments have a LinkedIn group. Sign in to keep in touch with us. 

    Using the Email List

    • You have been signed up for the class list
    • Send mail to: cs-11m@cis.cabrillo.edu
    • Read the email policy
    • Ask questions about homework
    • General questions about the class
    • Report issues with assignments
    • Email instructors directly for personal issues

    Online Lab Hours

    • The schedule of classes lists, "3 hr 5 min online lab per week".
    • You are graded, in part, on completing the online labs each week
    • These online lab hours are there to complete the assigned labs
    • You will need an Arduino, electronics kit and computer to complete most labs
    • If you do not have access to a computer, you may use one in the Computer Technology Center (CTC) or STEM Center (Map)

    Grading Options

    • On the first assignment, you determine your grading option: default, letter, credit/no-credit
    • To change your mind later in the course, up to the deadline, send me an email

    Academic Honesty

    • Do not cheat, lie or help others to cheat
    • Its OK to get help and to help others on homework, within limits
    • However, do not share code with others or copy code from others
    • Copying any amount of code without attribution is plagarism
    • See Scholastic Honesty Policy in Syllabus for more information

    Cell Phones and Texting

    • Cell phones are wonderful devices but are disruptive in the classroom
    • Texting and cell phone use are prohibited during class
    • Distractions waste your time and make you stressed out!

    Classroom Environment

    • I ensure a safe learning environment for everybody
    • I will treat you with courtesy and respect
    • I expect the same from you
    • No sarcasm, put downs, intolerance, or demeaning remarks
    • Listen while others are speaking
    • See Student Behavior Expectations in the Syllabus for more information
    • If you need help ask; if you already know, help other people to learn.
    • It's okay to be wrong -- but you need the courage to find out

    Other Useful Information and Links

    • Blackboard Help for instructions and tutorials on using Blackboard
    • Site Search at the top of the page for when you cannot easily find the information
    • Classroom Policies a few rules to make our learning more comfortable and fun
    • CodeLab Registration and Purchasing (Instructions TBA)

    Using a Text Editor

    • In the following exercise we need to use a text editor
    • A text editor is a basic tool used by programmers like a word processor is used by writers
    • Programmers use a text editor, rather than a word processor, because:
      • A word processor saves extra characters to control formatting whereas a text editor saves text with minimal formatting
      • Not all word processor files are interchangeable but text files generally are interchangeable
      • Word processors tend to be slow to start and complex to use while text editors are fast and simple to use
      • Most word processors can save files as plain text but we have to take care to specify the plain text format
    • Some of the text editors we can use are:
    • We use TextPad in the classroom and we can download it free for evaluation at home
    • Since we need to learn how to use programming tools, we will use text editors in this course
    • Do NOT use word processing programs like Word, LibreOffice or OpenOffice for assignments
    • To get us started, we will work together to use a text editor for the next exercise

    Exercise 2: Treasure Hunt! 

    In this exercise we explore the course web site to see how many of our questions we can answer. 


    1. Divide into teams of 3-4 people.
    2. Within your team, find the answers to the following questions:
      1. What is your personal Canvas login (NOT your password)?
      2. Where are the instructor's contact information located? (list the URLs)
      3. What is the Web address (URL) where all homework assignments are listed?
      4. When are assignments due? 
      5. What is the URL for the syllabus?
      6. What are the required books and materials for the course?
      7. What are three uses of the email list?
      8. When should you send an email to the instructor rather than the email list?
      9. Why is it a bad idea to multitask on your computer during class?
      10. Why are you not allowed to use cell phones during class?
      11. How should you get help when you are stuck?
    3. Prepare a text file (NOT a Word document) named: questions.txt containing the Treasure Hunt questions.
    4. At the top of the file, list the name of the people on your team
    5. Record your answers to each questions in the file. Write the answer after the question.
    6. When finished, save your file to upload to Blackboard as part of the first assignment (Project 1).
      1. All teams members upload their file to Blackboard.
      2. Do NOT email the answers to an instructor.

    When finished, please help those around you.

    Wrap Up and Reminders

    • For the next homework, see the schedule
    • When class is over, please shut down your computer.
    • Complete unfinished exercises from today before the next class meeting
    Subpages (1): Lab 0: Getting Ready