• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionca0a6ddb5058e9e5abba71189ae9f3eb26966f93 (tree)
Zeit2018-12-26 23:44:15
Autorkazuhiro_kondow <simauma.circus@gmai...>
Commiterkazuhiro_kondow

Log Message

BipolarTrangisterテスト
MOSFETテスト

Ändern Zusammenfassung

Diff

Binary files /dev/null and b/UNO/sketch_dec16a_BipolarTran/sketch_dec16a_BipolarTran.fzz differ
--- /dev/null
+++ b/UNO/sketch_dec16a_BipolarTran/sketch_dec16a_BipolarTran.ino
@@ -0,0 +1,25 @@
1+/*
2+* test bipolar transistor 2n2222A331
3+* this cheap transistor is unkown datasheets
4+*/
5+
6+const int gate_pin = 7;
7+void setup() {
8+ // put your setup code here, to run once:
9+ Serial.begin(9600);
10+ Serial.println("setup");
11+ // set pinmode
12+ pinMode(gate_pin,OUTPUT);
13+}
14+
15+void loop() {
16+ // put your main code here, to run repeatedly:
17+ Serial.print("loop:");
18+
19+ // bipolar gate close
20+ digitalWrite(gate_pin,LOW);
21+ delay(1000);
22+ // bipolar gate open
23+ digitalWrite(gate_pin,HIGH);
24+ delay(1000);
25+}
\ No newline at end of file
--- /dev/null
+++ b/UNO/sketch_dec17a/sketch_dec17a.ino
@@ -0,0 +1,71 @@
1+/*
2+ * this skech for EasyWordMall UNO R3開発ボード
3+ * test deep sleep
4+ */
5+
6+int wdt_cnt = 0;
7+//const int sleep_cnt = 113; // wdt 8sec niar 15min(904sec)
8+const int sleep_cnt = 2; // wdt test
9+void setup()
10+{
11+ Serial.begin(9600);
12+ Serial.println("setup");
13+ delay(500);
14+ // write all digital I/O LOW
15+ for (int i = 2; i < 14; i++) {
16+ pinMode(i, OUTPUT);
17+ }
18+ // set global interrupt enable
19+ SREG |= (1 << SREG_I);
20+}
21+
22+void loop()
23+{
24+ Serial.println("loop");
25+ delay(500);
26+ // set power-down mode
27+ SMCR |= (1 << SM1);
28+ SMCR |= 1;
29+
30+ // disable ADC
31+ ADCSRA &= ~(1 << ADEN);
32+
33+ // set watchdog timer
34+ asm("wdr");
35+ WDTCSR |= (1 << WDCE) | (1 << WDE);
36+ WDTCSR = (1 << WDIE) | (1 << WDP3) | (1 << WDP0); // 8 sec
37+ // WDTCSR = (1 << WDIE) | (1 << WDP2) | (1 << WDP0); // 0.5 sec
38+
39+ // disable BOD
40+ MCUCR |= (1 << BODSE) | (1 << BODS);
41+ MCUCR = (MCUCR & ~(1 << BODSE)) | (1 << BODS);
42+ Serial.println("sleep");
43+ delay(500);
44+ asm("sleep");
45+
46+
47+ // stop watchdog timer
48+ asm("wdr");
49+ MCUSR &= ~(1 << WDRF);
50+ WDTCSR |= (1 << WDCE) | (1 << WDE);
51+ WDTCSR = 0;
52+
53+ // enable ADC
54+ ADCSRA |= (1 << 7);
55+
56+ wdt_cnt = 0;
57+ Serial.println("wakeup");
58+ delay(1000);
59+
60+}
61+
62+//watchdog interrupt
63+ISR(WDT_vect)
64+{
65+ if (wdt_cnt < sleep_cnt) {
66+ digitalWrite(13, HIGH);
67+ delay(1000);
68+ digitalWrite(13, LOW);
69+ wdt_cnt++;
70+ }
71+}
--- /dev/null
+++ b/UNO/sketch_dec20a/.vscode/arduino.json
@@ -0,0 +1,5 @@
1+{
2+ "board": "arduino:avr:uno",
3+ "port": "COM3",
4+ "sketch": "sketch_dec20a.ino"
5+}
\ No newline at end of file
--- /dev/null
+++ b/UNO/sketch_dec20a/.vscode/c_cpp_properties.json
@@ -0,0 +1,19 @@
1+{
2+ "configurations": [
3+ {
4+ "name": "Win32",
5+ "includePath": [
6+ "C:\\Users\\user1\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\**",
7+ "C:\\Users\\user1\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\**"
8+ ],
9+ "forcedInclude": [
10+ "C:\\Users\\user1\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino\\Arduino.h"
11+ ],
12+ "intelliSenseMode": "msvc-x64",
13+ "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
14+ "cStandard": "c11",
15+ "cppStandard": "c++17"
16+ }
17+ ],
18+ "version": 4
19+}
\ No newline at end of file
Binary files /dev/null and b/UNO/sketch_dec20a/Sketch_dec20a.fzz differ
--- /dev/null
+++ b/UNO/sketch_dec20a/sketch_dec20a.ino
@@ -0,0 +1,179 @@
1+/*
2+ this skech for EasyWordMall UNO R3開発ボード
3+ test deep sleep and wakeup use byporra trangista
4+*/
5+#include <DHT.h>
6+#define DHTTYPE DHT11 // DHT 11
7+
8+//const int SLEEP_CNT = 113; // wdt 8sec niar 15min(904sec)
9+const int SLEEP_CNT = 10; // wdt test
10+
11+const int DHT_PW_PIN = 7; // PIN7
12+const int PHOTO_PW_PIN = 8; // PIN8
13+const int DHT_PIN = 9; // PIN9
14+const int PHOTO_PIN = A0; // Analog0
15+
16+void sleeping_now();
17+void reset_WatchDogTimer();
18+void read_DHT();
19+void read_PhotoSec();
20+
21+// Store values
22+int wdt_cnt = 0;
23+
24+DHT dht(DHT_PIN, DHTTYPE);
25+
26+void setup() {
27+ // put your setup code here, to run once:
28+ Serial.begin(9600);
29+ Serial.println("setup");
30+ delay(100);
31+
32+ // write all digital I/O LOW
33+ for (int i = 2; i < 20; i++) {
34+ pinMode(i, OUTPUT);
35+ }
36+ pinMode(DHT_PIN, INPUT);
37+ pinMode(PHOTO_PIN, INPUT);
38+
39+ // set global interrupt enable
40+ SREG |= (1 << SREG_I);
41+
42+ // DHT init
43+ dht.begin();
44+}
45+
46+void loop() {
47+ // put your main code here, to run repeatedly:
48+ Serial.println("loop");
49+ delay(100);
50+
51+ // Enable Sleep
52+ sleeping_now();
53+ reset_WatchDogTimer();
54+
55+ // Enable Sencers
56+ Serial.println("Activate Sencer");
57+ read_DHT();
58+ read_PhotoSec();
59+}
60+
61+//watchdog interrupt
62+ISR(WDT_vect)
63+{
64+ wdt_cnt++;
65+}
66+
67+void sleeping_now() {
68+ Serial.println("call sleeping_now");
69+ delay(100);
70+
71+ // set power-down mode
72+ SMCR |= (1 << SM1);
73+ SMCR |= 1;
74+
75+ // disable ADC
76+ ADCSRA &= ~(1 << ADEN);
77+
78+ // set watchdog timer
79+ asm("wdr");
80+ WDTCSR |= (1 << WDCE) | (1 << WDE);
81+ // WDTCSR = (1 << WDIE) | (1 << WDP3) | (1 << WDP0); // 8 sec
82+ WDTCSR = (1 << WDIE) | (1 << WDP2) | (1 << WDP0); // 0.5 sec
83+
84+ // disable BOD
85+ MCUCR |= (1 << BODSE) | (1 << BODS);
86+ MCUCR = (MCUCR & ~(1 << BODSE)) | (1 << BODS);
87+ while (wdt_cnt < SLEEP_CNT) {
88+ // Serial.print("Activate Sencer :");
89+ // Serial.println(wdt_cnt);
90+ delay(100);
91+ asm("sleep");
92+ }
93+}
94+
95+void reset_WatchDogTimer() {
96+ // stop watchdog timer
97+ asm("wdr");
98+ MCUSR &= ~(1 << WDRF);
99+ WDTCSR |= (1 << WDCE) | (1 << WDE);
100+ WDTCSR = 0;
101+
102+ // enable ADC
103+ ADCSRA |= (1 << 7);
104+ wdt_cnt = 0;
105+
106+ Serial.println("reset_WatchDogTimer");
107+ delay(100);
108+}
109+
110+void read_DHT() {
111+ Serial.println("read_DHT");
112+ delay(100);
113+
114+ // DHT on
115+ digitalWrite(DHT_PW_PIN, HIGH);
116+ delay(10);
117+
118+
119+ // Wait a few seconds between measurements.
120+ delay(2000);
121+
122+ // DHT read
123+ // Reading temperature or humidity takes about 250 milliseconds!
124+ // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
125+ float h = dht.readHumidity();
126+ // Read temperature as Celsius (the default)
127+ float t = dht.readTemperature();
128+ // Read temperature as Fahrenheit (isFahrenheit = true)
129+ float f = dht.readTemperature(true);
130+
131+ // Check if any reads failed and exit early (to try again).
132+ if (isnan(h) || isnan(t) || isnan(f)) {
133+ Serial.println("Failed to read from DHT sensor!");
134+ } else {
135+ // Compute heat index in Fahrenheit (the default)
136+ float hif = dht.computeHeatIndex(f, h);
137+ // Compute heat index in Celsius (isFahreheit = false)
138+ float hic = dht.computeHeatIndex(t, h, false);
139+ Serial.print("Humidity: ");
140+ Serial.print(h);
141+ Serial.print(" %\t");
142+ Serial.print("Temperature: ");
143+ Serial.print(t);
144+ Serial.print(" *C ");
145+ Serial.print(f);
146+ Serial.print(" *F\t");
147+ Serial.print("Heat index: ");
148+ Serial.print(hic);
149+ Serial.print(" *C ");
150+ Serial.print(hif);
151+ Serial.println(" *F");
152+ }
153+
154+ // DHT off
155+ digitalWrite(DHT_PW_PIN, LOW);
156+ delay(10);
157+
158+ return;
159+}
160+
161+void read_PhotoSec(){
162+ Serial.println("read_DHT");
163+ delay(100);
164+
165+ // PhotoSec on
166+ digitalWrite(PHOTO_PW_PIN, HIGH);
167+ delay(1000);
168+
169+ int photo_val = analogRead(PHOTO_PIN);
170+ Serial.print("Photo_Sencer:");
171+ Serial.println(photo_val);
172+ delay(100);
173+
174+ // PhotoSec off
175+ digitalWrite(PHOTO_PW_PIN, LOW);
176+ delay(10);
177+
178+ return;
179+}
--- /dev/null
+++ b/UNO/sketch_dec23a_DHTtester/sketch_dec23a_DHTtester.ino
@@ -0,0 +1,77 @@
1+// Example testing sketch for various DHT humidity/temperature sensors
2+// Written by ladyada, public domain
3+
4+#include "DHT.h"
5+
6+#define DHTPIN 9 // what digital pin we're connected to
7+
8+// Uncomment whatever type you're using!
9+#define DHTTYPE DHT11 // DHT 11
10+//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
11+//#define DHTTYPE DHT21 // DHT 21 (AM2301)
12+
13+// Connect pin 1 (on the left) of the sensor to +5V
14+// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
15+// to 3.3V instead of 5V!
16+// Connect pin 2 of the sensor to whatever your DHTPIN is
17+// Connect pin 4 (on the right) of the sensor to GROUND
18+// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
19+
20+// Initialize DHT sensor.
21+// Note that older versions of this library took an optional third parameter to
22+// tweak the timings for faster processors. This parameter is no longer needed
23+// as the current DHT reading algorithm adjusts itself to work on faster procs.
24+DHT dht(DHTPIN, DHTTYPE);
25+
26+void setup() {
27+ Serial.begin(9600);
28+ Serial.println("DHTxx test!");
29+ pinMode(7,OUTPUT);
30+ digitalWrite(7,HIGH);
31+ delay(10);
32+ dht.begin();
33+ digitalWrite(7,LOW);
34+ delay(10);
35+}
36+
37+void loop() {
38+ digitalWrite(7,HIGH);
39+ delay(10);
40+ // Wait a few seconds between measurements.
41+ delay(2000);
42+
43+ // Reading temperature or humidity takes about 250 milliseconds!
44+ // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
45+ float h = dht.readHumidity();
46+ // Read temperature as Celsius (the default)
47+ float t = dht.readTemperature();
48+ // Read temperature as Fahrenheit (isFahrenheit = true)
49+ float f = dht.readTemperature(true);
50+
51+ // Check if any reads failed and exit early (to try again).
52+ if (isnan(h) || isnan(t) || isnan(f)) {
53+ Serial.println("Failed to read from DHT sensor!");
54+ }else{
55+ // Compute heat index in Fahrenheit (the default)
56+ float hif = dht.computeHeatIndex(f, h);
57+ // Compute heat index in Celsius (isFahreheit = false)
58+ float hic = dht.computeHeatIndex(t, h, false);
59+
60+ Serial.print("Humidity: ");
61+ Serial.print(h);
62+ Serial.print(" %\t");
63+ Serial.print("Temperature: ");
64+ Serial.print(t);
65+ Serial.print(" *C ");
66+ Serial.print(f);
67+ Serial.print(" *F\t");
68+ Serial.print("Heat index: ");
69+ Serial.print(hic);
70+ Serial.print(" *C ");
71+ Serial.print(hif);
72+ Serial.println(" *F");
73+ }
74+
75+ digitalWrite(7,LOW);
76+ delay(1000);
77+}
Binary files "a/\351\226\213\347\231\272\343\203\255\343\202\260Book1.xlsx" and "b/\351\226\213\347\231\272\343\203\255\343\202\260Book1.xlsx" differ