Comments (4)
Hi 👋,
Oui, pour les ATtiny85 il faut utiliser un port série logiciel avec la librairie SoftwareSerial.
En ajoutant cet include au début du code :
#include <SoftwareSerial.h>
Puis en déclarant le port série virtuel juste après :
SoftwareSerial Serial(0, pin_TX);
(En replaçant "pin_TX" par le numéro de la pin connectée au coffre)
from bypass-sentry-safe.
Merci beaucoup pour la réponse rapide, j'avoue que j'ai essayé toute la journée... j'utilise le PIN P2(SCK) et PIN P3(USB+)donc si je comprends bien le code ça devrait ressembler exactement à ça ?
#include <SoftwareSerial.h>
SoftwareSerial Serial(0, 3);
const int pin = 1;
void send_request(int command, int a, int b, int c, int d, int e) {
int checksum = (command + a + b + c + d + e);
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
delayMicroseconds(2750);
digitalWrite(pin, HIGH);
delayMicroseconds(200);
Serial.begin(9600);
Serial.write((byte)0x0);
Serial.write(command);
Serial.write(a);
Serial.write(b);
Serial.write(c);
Serial.write(d);
Serial.write(e);
Serial.write(checksum);
Serial.end();
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
}
void reset_code(int a, int b, int c, int d, int e) {
send_request(0x75, a, b, c, d, e);
}
void try_code(int a, int b, int c, int d, int e) {
send_request(0x71, a, b, c, d, e);
}
void setup() {
reset_code(1,2,3,4,5);
delay(1000);
try_code(1,2,3,4,5);
}
void loop() {}
from bypass-sentry-safe.
Il faut aussi changer la variable pin avec la même valeur, donc si c'est la pin 3, cela peut donner :
#include <SoftwareSerial.h>
const int pin = 3;
SoftwareSerial Serial(0, pin);
...
Avec la pin 3 sur le fil vert du coffre et le fil noir relié à la masse de l'ATtiny85.
from bypass-sentry-safe.
Il faut aussi changer la variable pin avec la même valeur, donc si c'est la pin 3, cela peut donner :
#include <SoftwareSerial.h> const int pin = 3; SoftwareSerial Serial(0, pin); ...Avec la pin 3 sur le fil vert du coffre et le fil noir relié à la masse de l'ATtiny85.
Malheureusement, maintenant, cela me donne une autre erreur, vous ne pouvez pas m'envoyer le code directement pour que je puisse l'essayer :(
`#include <SoftwareSerial.h>
const int pin = 3;
SoftwareSerial Serial(0, 2);
void send_request(int command, int a, int b, int c, int d, int e) {
int checksum = (command + a + b + c + d + e);
pinMode(pin, OUTPUT);
digitalWrite(pin, LOW);
delayMicroseconds(2750);
digitalWrite(pin, HIGH);
delayMicroseconds(200);
Serial.begin(9600);
Serial.write((byte)0x0);
Serial.write(command);
Serial.write(a);
Serial.write(b);
Serial.write(c);
Serial.write(d);
Serial.write(e);
Serial.write(checksum);
Serial.end();
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
}
void reset_code(int a, int b, int c, int d, int e) {
send_request(0x75, a, b, c, d, e);
}
void try_code(int a, int b, int c, int d, int e) {
send_request(0x71, a, b, c, d, e);
}
void setup() {
reset_code(1,2,3,4,5);
delay(1000);
try_code(1,2,3,4,5);
}
void loop() {}`
Error = Using library SoftwareSerial at version 1.0 in folder: /home/lev/snap/arduino/current/Arduino/libraries/SoftwareSerial
exit status 1
conflicting declaration 'SoftwareSerial Serial'
from bypass-sentry-safe.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bypass-sentry-safe.