You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

iocontrol_serialout

iocontrol_serialout_fsm1

iocontrol_serialout_fsm2

  • behavior:
    • repeat the print sequence in iocontrol_serialout_fsm1 for a number of times
  • pre-requisite:
    • iocontrol_serialout_fsm1
  • concepts:
    • extended from iocontrol_serialout
    • add another variable to control repeat count

iocontrol_serialin

binout_timedwrite

binout_serialin_timedwrite

binout_play_oneseq

binout_play_altseq

binout_serialin_playseq_immed

binout_serialin_playseq_follow

binin_changetime

adc_read

  • circuit:
  • behavior:
    • joystick analog outputs connect to IO00 and IO01 respectively
    • read analog outputs every 100ms and outputs on Serial Monitor
  • pre-requisite:
    • iocontrol_serialout
  • concepts
    • ADCControl
      • init - adc_index (must be 1), pin index (must be 0 to 4)
      • read
      • getMaxValue

adc_thres

  • circuit:
  • behavior:
    • set threshold for three regions, and report an ID for region (0,1, or 2) of each analog input on Serial Monitor when ID changed
  • pre-requisite:
    • adc_read
  • concepts
    • ADCControl
      • enableScheduler and handler
      • setThreshold
      • isIndexChanged
      • getLastIndex
      • getLastChangeTime
      • getLastValue
    • getLastXXX only valid when isIndexChanged is true
    • vector and initialization
      • std::vector - search for "std::vector" online for documentation
      • template
      • push_back

adc_binin_joystick

  • circuit:
  • behavior:
    • handlers for detecting ADC at IO00 and IO01, and threshold in three ranges
    • when button is pushed or released, change time is determined and current state of ADC0 and ADC1 are printed
  • pre-requisite:
    • adc_thres
    • binin_changetime
  • concepts:
    • INPUT_PULLUP for IO05, so that no external pull-up resistor is required

pwm_setduty

  • behavior:
    • use PWM output on IO12 to change brightness from fully-off to fully-on
    • interval = 50ms, each interval increment duty by 100
  • pre-requisite:
    • iocontrol_serialout
  • concepts:
    • PWMControl
      • init
      • getFreq
      • setDuty(duty)
    • maximum 6 PWM channels, map to any GPIO output
    • all with same frequency, but can have different duty

pwm_play_oneseq

  • behavior:
    • play back a PWM sequence for two times
  • pre-requisite:
    • pwm_setduty

    • binout_play_oneseq
  •  concepts:
    • PWMSequence
      • addSetDuty
      • addFade
    • PWMControl
      • playRelTime

servo_setAngle

servo_play_oneseq

  • circuit:
    • use SG90 servo motor
    • connections:
      • SG90ESP32C3
        PWMIO08
        VCC5V
        GNDGND
  • behavior:
    • play back one servo motor sequence for once
    • smooth movement when interval is smaller (50ms vs 20ms)
  • pre-requisite:
    • servo_setAngle

    • binout_play_oneseq
  • concepts:
    • ServoSequence
      • addSetAngle
      • addMoveFromToAngle
    • has to pass ServoControl object for checking 
      • maximum angular speed = 60deg/0.1s
      • angle limits = from 0 to 180 degrees
    • angle should NOT be too close to the extreme limit; prefer to use the range 20 to 160 instead to avoid damaging servo motor

tone_setTone

  • circuit:
    • use piezo speaker
    • connections:
      • piezo speakerESP32C3
        +veIO13
        GNDGND
  • behavior:
    • play a frequency and a note, each for 250ms
  • pre-requisite
    • iocontrol_serialout_fsm1
    • iocontrol_serialout_fsm2
  • concepts
    • ToneControl
      • init
      • setTone
      • setNote ( notebase, octave, duty)
        • NoteBaseType refer to ToneControl.h
        • octave - from 0 to 8
      • getMaxDuty
    • setTone
      • freq ==0 means silent

tone_play_oneseq

  • circuit:
    • use piezo speaker
    • connections:
      • piezo speakerESP32C3
        +veIO13
        GNDGND
  • behavior:
    • play a tone sequence for once
  • pre-requisite
    • tone_setTone
    • binout_play_oneseq
  • concepts:
    • ToneSequence
      • addSetTone
      • addSetNote
      • addInterpolateTone

mpr121_touchrelease_event

  • circuit:
  • behavior:
    • initialize MPR121 module and report touch and release event at each terminal and time of detection
  • pre-requisite
    • binin_changetime
  • concepts
    • MPR121Control
      • isTouchReleaseEvent
      • touchedTimeMS[]
      • releasedTimeMS[]
    • for loop
    • access of element in vector/array (not std::vector)

addrled_setColor

addrled_play_seqs

  • circuit:
    • WS2812 strip with at least 4 LEDs
    • connections
      • WS2812ESP32C3
        DINIO19
        +5V5V
        GNDGND
  • behavior:
    • defined three sequences
    • expect 4 LEDs, and divided into three groups, each group play one sequence
    • for one group, sequence is continued playing after ending the sequence
  • pre-requisite:
    • binout_play_altseq
    • binout_play_altseq
  • concepts:
    • AddrLEDControl
      • playRelTime
    • AddrLEDSequence
      • addSetRGB
      • addSetHSV
      • addSetInterpolateRGB
      • addSetInterpolateHSV

addrLED_seq_pause_resume

  • circuit:
    • WS2812 strip with at least 2 LEDs
    • connections
      • WS2812ESP32C3
        DINIO19
        +5V5V
        GNDGND
  • behavior:
    • define two sequences and play back each sequence to each group, with one LED per group
    • one sequence paused after playing 2nd command, and then resume after the other sequence completed playing
  • pre-requisite:
    • addrled_play_seqs
  • concepts:
    • AddrLEDControl::pauseBeforeNextCommand()
    • AddrLEDControl::isOneSeqPaused()
    • AddrLEDControl::resume()

oled_display_time

  • circuit:
    • use SH1106 or SSD1306 OLED display
    • connections
      • SH1106 or SSD1306 displayESP32C3
        VCC3.3v
        GNDGND
        SCLIO10
        SDAIO06
  • behavior:
    • initialize SH1106 display and display current time in HH:MM:SS format
    • time since reset
  • pre-requisite:
    • binout_timedwrite
  • concepts:

oled_display_ntptime

  • circuit:
    • use SH1106 or SSD1306 OLED display
    • connections
      • SH1106 or SSD1306 displayESP32C3
        VCC3.3v
        GNDGND
        SCLIO10
        SDAIO06
  • behavior:
    • connect to the SSID with password in the source code, and connect to the NTP server
    • initialize SH1106 display and display current time in HH:MM:SS format
    • If failed to connect to SSID, time since reset will be used instead of the local time
  • pre-requisite:
    • oled_display_time
  • concepts:
    • connect to SSID using WiFiControl

oled_display_bitmap

mp3_dfplayer

  • No labels