บทความ

กำลังแสดงโพสต์จาก กรกฎาคม, 2019

(ชิ้นงานที่4ของเดือน ก.ค)DC Motor Control Using MATLAB and Arduino

รูปภาพ
function varargout = DCmotor(varargin) gui_Singleton = 1; gui_State = struct('gui_Name',       mfilename, ...                    'gui_Singleton',  gui_Singleton, ...                    'gui_OpeningFcn', @DCmotor_OpeningFcn, ...                    'gui_OutputFcn',  @DCmotor_OutputFcn, ...                    'gui_LayoutFcn',  [] , ...                    'gui_Callback',   []); if nargin && ischar(varargin{1})     gui_State.gui_Callback = str2func(varargin{1}); end if nargout     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else     gui_mainfcn(gui_State, varargin{:}); end function DCmotor_OpeningFcn(hObject, eventdata, handles, varargin) guidata(hObject, handles); function varargout = DCmotor_OutputFcn(hObject, eventdata, handles)  varargout{1} = handles.output; clear all; global a; a = arduino(); function clockwise_Callback(hObject, eventdata, handles) global a; writeDigitalPin(a

(ชิ้นงานที่3ของเดือน ก.ค)Controlling Home Lights with Touch using TTP223 Touch Sensor and Arduino UNO

รูปภาพ
#include <Arduino.h>   //#define ON 1 //#define OFF 0   /*  * Pin Description  */ int Touch_Sensor = A5; int LED = 13; int Relay = A4;   /*  * Programme flow Description  */ int condition = 0; int state = 0; //To hold the switch state.   /*  * Pin mode setup  */ void setup() { pinMode(Touch_Sensor, INPUT); pinMode(LED, OUTPUT); pinMode(Relay, OUTPUT); }   void loop() { condition = digitalRead(A5); // Reading digital data from the A5 Pin of the Arduino.   if(condition == 1){ delay(250); // de-bounce delay. if(condition == 1){ state = ~state; // Changing the state of the switch. digitalWrite(LED, state); digitalWrite(Relay, state); } } }

(ชิ้นงานที่2ของเดือน ก.ค)Arduino Whistle Detector Switch using Sound Sensor

รูปภาพ
#include  void setup() {   Serial.begin(9600);   FreqMeasure.begin(); //Measures on pin 8 by default   pinMode(LED_BUILTIN, OUTPUT); } double sum=0; int count=0; bool state = false; float frequency; int continuity =0; void loop() {   if (FreqMeasure.available()) {     // average several reading together     sum = sum + FreqMeasure.read();     count = count + 1;     if (count > 100) {       frequency = FreqMeasure.countToFrequency(sum / count);       Serial.println(frequency);       sum = 0;       count = 0;     }   }     if (frequency>1800 && frequency<2000)     { continuity++; Serial.print("Continuity -> "); Serial.println(continuity); frequency=0;}     if (continuity >=3 && state==false)       {state = true; continuity=0; Serial.println("Light Turned ON"); delay(1000);}     if (continuity >=3 && state==true)       {state = false; continuity=0; Serial.println("Light Turned OFF");

(ชิ้นงานที่1ของเดือน ก.ค)Arduino based Text to Speech (TTS) Converter

รูปภาพ
#include "Talkie.h" #include "Vocab_US_Large.h" #include "Vocab_Special.h" Talkie voice; void setup() { } void loop() {     voice.say(spPAUSE2);     voice.say(sp2_DANGER);     voice.say(sp2_DANGER);     voice.say(sp3_STORM);     voice.say(sp3_IN);     voice.say(sp3_THE);     voice.say(sp3_NORTH); }