🎨
MadMachine-Examples
  • Introduction
  • About our project
  • Getting Started
  • Tutorial
    • What is SwiftIO
    • How to use IDE
    • Libraries
    • MM SDK
  • Built-In Examples
    • GettingStarted
      • Blink
      • ReadDigitalInput
      • ReadAnalogInput
      • PWMBrightnessControl
    • SimpleIO
      • ButtoncontrolLED
      • BlinkAnalogIn
      • BlinkTimer
      • BrightnessAnalogIn
      • Debounce
      • LEDsBrightnessControl
      • PWMSoundOutput
      • PWMMelody
    • AdvancedIO
      • ILI9341
      • LCD1602
      • MidiPlayer
      • PCA9685
      • SHT3x
      • SSD1315
    • Challenge
      • LCDFamily
      • RobotArm
      • Tetris
    • MakerKit
      • Mission 01 Blink
      • Mission 02 RGB LED
      • Mission 03 Push Button
      • Mission 04 Potentiometer RGB
      • Mission 05 Buzzer
      • Mission 06 Seven Segment Display
      • Mission 07 DC Motor
      • Mission 08 Servo Motor
      • Mission 09 LCD
      • Mission 10 Humiture Sensor
  • Library Reference
  • FAQ
Powered by GitBook
On this page

Was this helpful?

  1. Built-In Examples

SimpleIO

PreviousPWMBrightnessControlNextButtoncontrolLED

Last updated 4 years ago

Was this helpful?

After finished last part, you must know how to use input and output pins.

Now you are ready to go. We are going to get things more exciting. 😎

Follow these examples based on what you have learned before.

  • - when the button is pressed, the input value will be changed. If it is detected, turn on the led.

  • - change the sleep time with the raw value read from analog pin to change the blink frequency.

  • - use the timer to set interrupt and every second the led will be toggled.

  • - set the duty cycle of the PWM output with the float number between 0.0 and 1.0 read from the analog pin.

  • - when the button is pressed, check the input signal in a certain period to ensure the exact status of the button and then turn on the onboard led.

  • - brighten and dim three LEDs alternatively by increasing and decreasing the duty cycle of the PWM output.

  • - change the frequency of the PWM output to generate different notes.

  • - list a combination of the frequencies of different pitches to generate a harmonious melody.

ButtoncontrolLED
BlinkAnalogIn
BlinkTimer
BrightnessAnalogIn
Debounce
LEDsBrightnessControl
PWMSoundOutput
PWMMelody