OneWire example
OneWire example
#include <io>
#include <read>
#include <float>
#include <string>
#include <core>
#include <write>
#include <define>
#include <socket>
#define EXIT_SUCCESS 1
#define EXIT_FAILURE 0
main()
{
new length;
new buff[200];
Init(RS232, 9600, WORDLENGTH_8, STOPBITS_1, PARITY_NONE);
while(Init(OneWire_function, 9600, PullUp_5V) != EXIT_SUCCESS)
{
write_buf(RS232, 8, "Failed\r\n");
Delay(1000);
}
while(1)
{
write_buf(OneWire_function, 9, "Testas \r\n");
length = buf_len(OneWire_function);
if (length != 0)
{
read_buf(OneWire_function, length, buff);
write_buf(RS232, length, buff);
}
Delay(1000);
}
}