Improve gitignore for PlatformIO + macOS
This commit is contained in:
parent
1668ca09e5
commit
e2347c29d2
4 changed files with 61 additions and 17 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# macOS junk
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
|
||||
# PlatformIO build + deps (ANY folder)
|
||||
**/.pio/
|
||||
.platformio/
|
||||
|
||||
# VS Code (all subprojects)
|
||||
**/.vscode/
|
||||
5
Source/ports/OpEnerTeensy/.gitignore
vendored
5
Source/ports/OpEnerTeensy/.gitignore
vendored
|
|
@ -1,5 +0,0 @@
|
|||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
|
|
@ -1,21 +1,59 @@
|
|||
#include <Arduino.h>
|
||||
#include <QNEthernet.h>
|
||||
|
||||
// put function declarations here:
|
||||
int myFunction(int, int);
|
||||
using namespace qindesign::network;
|
||||
|
||||
// Network config
|
||||
IPAddress ip(192, 168, 1, 177); // change to your network
|
||||
IPAddress gateway(192, 168, 1, 1);
|
||||
IPAddress subnet(255, 255, 255, 0);
|
||||
|
||||
EthernetUDP udp;
|
||||
const uint16_t localPort = 2222; // EtherNet/IP uses 2222 (good test)
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
int result = myFunction(2, 3);
|
||||
Serial.begin(115200);
|
||||
delay(2000);
|
||||
|
||||
Serial.println("Starting Ethernet...");
|
||||
|
||||
Ethernet.begin(ip, subnet, gateway);
|
||||
|
||||
if (!Ethernet.linkStatus()) {
|
||||
Serial.println("Ethernet cable not connected!");
|
||||
}
|
||||
|
||||
Serial.print("IP: ");
|
||||
Serial.println(Ethernet.localIP());
|
||||
|
||||
udp.begin(localPort);
|
||||
|
||||
Serial.print("Listening on UDP port: ");
|
||||
Serial.println(localPort);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
int data = myFunction(50,1);
|
||||
Serial.print((int)data);
|
||||
delay(1000);
|
||||
}
|
||||
int packetSize = udp.parsePacket();
|
||||
|
||||
// put function definitions here:
|
||||
int myFunction(int x, int y) {
|
||||
return x + y;
|
||||
if (packetSize) {
|
||||
Serial.print("Received packet: ");
|
||||
Serial.println(packetSize);
|
||||
|
||||
char buffer[512];
|
||||
int len = udp.read(buffer, sizeof(buffer));
|
||||
|
||||
if (len > 0) {
|
||||
buffer[len] = 0;
|
||||
}
|
||||
|
||||
Serial.print("Data: ");
|
||||
Serial.println(buffer);
|
||||
|
||||
// Echo back
|
||||
udp.beginPacket(udp.remoteIP(), udp.remotePort());
|
||||
udp.write((const uint8_t*)"ACK", 3);
|
||||
udp.endPacket();
|
||||
|
||||
Serial.println("Sent ACK");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue