diff --git a/.DS_Store b/.DS_Store index 86762060..d311e28c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Development/.DS_Store b/Development/.DS_Store index b3e70dee..f303cc22 100644 Binary files a/Development/.DS_Store and b/Development/.DS_Store differ diff --git a/Development/Jetson_I2C_GLCD/ip_address.py b/Development/Jetson_I2C_GLCD/ip_address.py new file mode 100644 index 00000000..e6e24cff --- /dev/null +++ b/Development/Jetson_I2C_GLCD/ip_address.py @@ -0,0 +1,18 @@ +import socket +import os +f = os.popen('ifconfig eth0 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1') +IPAddr=f.read() + + +#hostname = socket.gethostname() +#IPAddr = socket.gethostbyname(hostname) + +#print("Your Computer Name is:" + hostname) +#print("Your Computer IP Address is:" + IPAddr) +def main(): + file = open(r"ip.txt", "w+") + file.write(IPAddr) + file.close() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Development/Jetson_I2C_GLCD/jetson_i2c_glcd.cpp b/Development/Jetson_I2C_GLCD/jetson_i2c_glcd.cpp index 50705fe6..6189fd58 100755 --- a/Development/Jetson_I2C_GLCD/jetson_i2c_glcd.cpp +++ b/Development/Jetson_I2C_GLCD/jetson_i2c_glcd.cpp @@ -17,6 +17,10 @@ #include #include +//#include +#include +using namespace std; + #include #define BLACK 0 @@ -431,7 +435,7 @@ int cursor_x = 0; int textsize = 0; uint16_t textcolor = 0xFFFF; uint16_t textbgcolor = 0xFFFF; -char ip[14] = "138.51.120.89"; +//char ip[14] = "138.51.120.89"; void drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size); @@ -763,6 +767,25 @@ void print_ip_address(char ip_address[]){ int main(){ + int result = system("python ip_address.py 1"); + int arraysize=14; + char ip[arraysize]; + char current_char; + + int num_characters = 0; + int i = 0; + + ifstream myfile; + myfile.open("ip.txt"); + if (myfile.is_open()){ + while(!myfile.eof()){ + myfile >> ip; + + } + } + printf("%s",ip); + myfile.close(); + int FileDescriptor = open(); begin(FileDescriptor); @@ -776,4 +799,4 @@ int main(){ close(FileDescriptor); return 0; -} +} \ No newline at end of file