hi all,
I want to iterate through some IP addresses in Arduino code.
I only want through certain IPs, like 192.168.1.0-255
But I dont know how to combine an iterator with a string, and then provide that to a varable that can be processed as an IP address.
here is some code to try and do what i want:
void setup()
{
Serial.begin(9600);
for (int i = 0; i <=255; i++)
{
byte server[] = { 192, 168, 1, i };
Serial.println(server);
}
}
void loop(){} //do nothing.
but that overloads the println function, and the compiler says its ambiguous.
Evidently println doesnt take bytes. Is there typecasting or typedef conversions I could do?
anyone have some insight I can borrow?
in Bash scripting what I would do is:
#!/bin/bash
for i in `seq 0 255`
do
./getHost 192.168.1.$i
done