Bonjour à toutes et à tous!
Je suis débutante et je me suis lancée sur la carte Teensy LC et j'aimerais beaucoup reproduire le projet sur la vidéo : https://www.youtube.com/watch?v=D80M_E2c5dw
J'ai fais le circuit avec les résistances les Leds etc..
Et j'ai recopié le code de la vidéo que je vous mets ci-dessous. Sauf que j'ai des erreurs et je ne connais pas le langage du Arduino, j'ai fais des recherches mais je n'ai pas réussi à trouver. (J'ai travaillé un peu sur une Raspberry pi mais ce n'est apparemment pas le même langage) Est ce que ce serait possible de m'aider? Je vous remercie :)
ERREUR :
LE PROGRAMME:essaie_sensor_3led:34: error: variable or field 'setup' declared void void setup ^ essaie_sensor_3led:37: error: expected '}' before ';' token pinMode (ledPin1, OUTPUT); ^ essaie_sensor_3led:38: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin2, OUTPUT); ^ essaie_sensor_3led:39: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin3, OUTPUT); ^ essaie_sensor_3led:40: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin4, OUTPUT); ^ essaie_sensor_3led:41: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin5, OUTPUT); ^ essaie_sensor_3led:42: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin6, OUTPUT); ^ essaie_sensor_3led:43: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin7, OUTPUT); ^ essaie_sensor_3led:44: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin8, OUTPUT); ^ essaie_sensor_3led:45: error: expected constructor, destructor, or type conversion before '(' token pinMode (ledPin9, OUTPUT); ^ essaie_sensor_3led:46: error: 'Serial' does not name a type Serial.begin(9600); ^ essaie_sensor_3led:47: error: expected declaration before '}' token } ^ exit status 1
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 #include <CapacitiveSensor.h> int touchPin1 = 0; int touchPin2 = 1; int touchPin3 = 15; int touchPin4 = 16; int touchPin5 = 17; int touchPin6 = 18; int touchPin7 = 19; int touchPin8 = 22; int touchPin9 = 23; int touchReading1 = 0; int touchReading2 = 0; int touchReading3 = 0; int touchReading4 = 0; int touchReading5 = 0; int touchReading6 = 0; int touchReading7 = 0; int touchReading8 = 0; int touchReading9 = 0; const int ledPin1 = 11; const int ledPin2 = 2; const int ledPin3 = 3; const int ledPin4 = 4; const int ledPin5 = 5; const int ledPin6 = 6; const int ledPin7 = 7; const int ledPin8 = 8; const int ledPin9 = 9; const int StartThreshold = 1170; const float LedMultiplier = 0.04; void setup { // set pin mode pinMode (ledPin1, OUTPUT); pinMode (ledPin2, OUTPUT); pinMode (ledPin3, OUTPUT); pinMode (ledPin4, OUTPUT); pinMode (ledPin5, OUTPUT); pinMode (ledPin6, OUTPUT); pinMode (ledPin7, OUTPUT); pinMode (ledPin8, OUTPUT); pinMode (ledPin9, OUTPUT); Serial.begin(9600); } void loop { long start = nillis(); touchReading1 = touchRead (touchPin1); touchReading2 = touchRead (touchPin2); touchReading3 = touchRead (touchPin3); touchReading4 = touchRead (touchPin4); touchReading5 = touchRead (touchPin5); touchReading6 = touchRead (touchPin6); touchReading7 = touchRead (touchPin7); touchReading8 = touchRead (touchPin8); touchReading9 = touchRead (touchPin9); Serial.print(nillis()- start), Serial.print("\t"); Serial.print(touchReading6); Serial.print("\t"); Serial.print(touchReading7); Serial.print("\t"); Serial.print(touchReading8); Serial.print("\t"); Serial.print(touchReading9); if (touchReading1 > 2700) { // set LED on or off digitalWrite (ledPin1,HIGH); } else { digitalWrite (ledPin1,LOW); } if (touchReading2 > 2700) { digitalWrite (ledPin2,HIGH); } else { digitalWrite (ledPin2,LOW); } int touchReading31 = (touchReading3 - StartThreshold * LedMultiplier; // example on pin 3 analogWrite (ledPin3, touchReading31)) ; // set PWM on pin, not all pins are PWM capable int touchReading41 = (touchReading4 - StartThreshold * LedMultiplier; analogWrite (ledPin4, touchReading41)) ; int touchReading51 = (touchReading5 - StartThreshold * LedMultiplier; analogWrite (ledPin5, touchReading51)) ; int touchReading61 = (touchReading6 - StartThreshold * LedMultiplier; analogWrite (ledPin6, touchReading61)) ; if (touchReading7 > 2700){ digitalWrite (ledPin7,HIGH) } else { digitalWrite(ledPin7,LOW) if (touchReading8 > 2700){ digitalWrite (ledPin8,HIGH) } else { digitalWrite(ledPin8,LOW) if (touchReading9 > 2700){ digitalWrite (ledPin9,HIGH) } else { digitalWrite(ledPin9,LOW) } delay (10)