This is a library for the electrical control of muscles. 筋肉に電気を流して制御して遊ぶためのライブラリ

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MuscleWrite.h Source File

MuscleWrite.h

Go to the documentation of this file.
00001 /*!
00002  * @file MuscleWrite.h
00003  * @brief basic program for muscle controll with mbed/nucleo f446RE 
00004  * @author m.hdk <m.hdk816@gmail.com>
00005  * @date 2021
00006  */
00007 
00008 #ifndef MuscleWrite_H
00009 #define MuscleWrite_H
00010 
00011 #include "mbed.h"
00012 
00013 class MuscleWrite
00014 {
00015 public:
00016     MuscleWrite(PinName pulse_pin, float period = 0.025, float width = 0.002);
00017     void enable();
00018     void disable();
00019     void write(bool s);
00020 
00021 private:
00022     Timeout tim;
00023     Ticker tic;
00024     DigitalOut pulse_pin_;
00025     float period_;
00026     float width_;
00027     bool out;
00028     int over_cut_width();
00029     void rise();
00030     void fall();
00031 };
00032 
00033 #endif