I'am trying to write a program that simulates a device that communicates via Serial over TCP/IP.
I figured out I need to save everything in a single String before transmitting or the data gets fragmented and the PC software cant interpret it. Got that working. Now I need a working time stamp... it doesn't have to be correct time... I don't even car if its 24 or 12 hr format
It has to be formatted as hours:minutes:seconds
I'm getting frustrated and need help lol the time librarys seem so complicated
here is what I have working
#include <SPI.h>
#include <Ethernet.h>
#include <stdlib.h>
// mac and ip
byte mac[] = {
0x90, 0xA2, 0xDA, 0x00, 0xC6, 0x10 };
IPAddress ip(10,0,16,3);
// initilaze servers
EthernetServer server1(4001);
EthernetServer server2(4002);
// String variables
String Sblender, Schemadd;
// data feilds - clean,drv disch,drv clean,pass disch,pass clean,
// auger1,auger2,auger3,auger4,meas dens, target,
// calculated
float blender[] = {
50.2, 48.5, 24.1, 1.7, 26.0,
25, 15, 0, 25, 0.27, 0.25, 0.25};
int chemadd[] = {
1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0};
// buffers counters and junk
char tmp[4];
void setup() {
// start connection and server:
Ethernet.begin(mac, ip);
server1.begin();
server2.begin();
}
void loop() {
// append data feilds to string
Sblender = ("10:23:67"); // constant for now NEED TO FIX
for( int i = 0; i < 12; i++){
Sblender += (",");
dtostrf(blender[i],1,2,tmp);
Sblender += tmp;
}
// Transmit no more than once a second
delay(1000);
// talk to me !
server1.println(Sblender);
}