浏览代码

example code; renamed main file

master
Robin Thoni 9 年前
父节点
当前提交
be871490fb
共有 3 个文件被更改,包括 23 次插入10 次删除
  1. 1
    1
      CMakeLists.txt
  2. 0
    9
      arduinoProject.ino
  3. 22
    0
      main.ino

+ 1
- 1
CMakeLists.txt 查看文件

@@ -8,5 +8,5 @@ set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB0)
8 8
 
9 9
 enable_language(ASM)
10 10
 
11
-set(${CMAKE_PROJECT_NAME}_SKETCH arduinoProject.ino)
11
+set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
12 12
 generate_arduino_firmware(${CMAKE_PROJECT_NAME})

+ 0
- 9
arduinoProject.ino 查看文件

@@ -1,9 +0,0 @@
1
-#include <Arduino.h>
2
-
3
-void setup() {
4
-
5
-}
6
-
7
-void loop() {
8
-
9
-}

+ 22
- 0
main.ino 查看文件

@@ -0,0 +1,22 @@
1
+#include <Arduino.h>
2
+
3
+#define ledPin 13
4
+
5
+void setup() {
6
+    pinMode (ledPin, OUTPUT);
7
+
8
+    digitalWrite (ledPin, LOW);
9
+}
10
+
11
+void delayMs(unsigned int ms)
12
+{
13
+    for (unsigned i = 0; i < ms; i++) {
14
+        delayMicroseconds(1000);
15
+    }
16
+}
17
+
18
+void loop() {
19
+
20
+    digitalWrite(ledPin, !digitalRead(ledPin));
21
+    delayMs(1000);
22
+}

正在加载...
取消
保存