This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
const char* ssid = "my_arduino"; | |
const char* password = "0927566556"; | |
int ledPin1 = D1; // ขา D1 | |
int ledPin2 = D2; // ขา D2 | |
int ledPin3 = D3; // ขา D3 | |
int ledPin4 = D4; // ขา D4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********* | |
Rui Santos | |
Complete project details at http://randomnerdtutorials.com | |
*********/ | |
// Including the ESP8266 WiFi library | |
#include <ESP8266WiFi.h> | |
#include "DHT.h" | |
// Uncomment one of the lines below for whatever DHT sensor type you're using! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Wire.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
#define OLED_RESET 4 | |
Adafruit_SSD1306 display(OLED_RESET); | |
void setup() { | |
display.begin(SSD1306_SWITCHCAPVCC, 0x3c); //initialize I2C addr 0x3c | |
display.clearDisplay(); // clears the screen and buffer | |
display.drawPixel(127, 63, WHITE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int led1 = 3; // กำหนดขาใช้งาน | |
int val = 1; | |
void setup() | |
{ | |
pinMode(led1, OUTPUT); // กำหนดขาทำหน้าที่ให้ขา 3 เป็น OUTPUT | |
Serial.begin(9600); | |
Serial.println("My arduino"); | |
} | |
void loop() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int led1 = 3; // กำหนดขาใช้งาน | |
int led2 = 4; // กำหนดขาใช้งาน | |
int led3 = 5; // กำหนดขาใช้งาน | |
char key = '0' ; //ตัวแปรเก็บค่าที่คอมพิวเตอร์ส่งมา | |
void setup() | |
{ | |
pinMode(led1, OUTPUT); // กำหนดขาทำหน้าที่ให้ขา 3 เป็น OUTPUT | |
pinMode(led2, OUTPUT); // กำหนดขาทำหน้าที่ให้ขา 4 เป็น OUTPUT | |
pinMode(led3, OUTPUT); // กำหนดขาทำหน้าที่ให้ขา 5 เป็น OUTPUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char key = '0' ; //ตัวแปรเก็บค่าที่คอมพิวเตอร์ส่งมา | |
void setup() | |
{ | |
Serial.begin(9600); | |
Serial.println("My arduino"); | |
} | |
void loop() | |
{ | |
if (Serial.available() > 0) { //ถ้าคอมพิวเตอร์ส่งข้อมูลมาใหจะทำใน if นี้ | |
key = Serial.read(); //นำค่าที่คอมพิวเตอร์ส่งมาเก็บในตัวแปร key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char key = '0' ; //ตัวแปรเก็บค่าที่คอมพิวเตอร์ส่งมา | |
void setup() | |
{ | |
Serial.begin(9600); | |
Serial.println("My arduino"); | |
} | |
void loop() | |
{ | |
if (Serial.available() > 0) { //ถ้าคอมพิวเตอร์ส่งข้อมูลมาใหจะทำใน if นี้ | |
key = Serial.read(); //นำค่าที่คอมพิวเตอร์ส่งมาเก็บในตัวแปร key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int ledPin3 = 3; | |
int ledPin5 = 5; | |
int ledPin6 = 6; | |
int ledPin9 = 9; | |
void setup() { | |
pinMode(ledPin3, OUTPUT); | |
pinMode(ledPin5, OUTPUT); | |
pinMode(ledPin6, OUTPUT); | |
pinMode(ledPin9, OUTPUT); | |
Serial.begin(9600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
Serial.println("Test for myarduino"); // พิมพ์ข้อมความส่งเข้าคอมพิวเตอร์ "Test for myarduino" | |
for (int x = 0; x < 10; x++) { //ให้วนรอบโดยกำหนดให้ X = 0 ถึง 9 | |
Serial.print("X = "); // พิมพ์ข้อมความส่งเข้าคอมพิวเตอร์ "X = " | |
Serial.println(x); // พิมพ์ค่าชองตัวแปร x | |
delay(200); //หน่วงเวลา 200mS |
OlderNewer