# Adding Deep Learning AI to Internet of Things (IoT) - Part 3

Guest Author

 Now we see how the Perceptron equation is written out in mathematical format, we want to turn this into some computer code for adding Deep Learning AI to IoT. We'll start out by converting just this "output" equation into Java code.The output is a binary function that returns 1 for yes (Ex. the IoT sensors indicate that yes, this guy that just walked passed my sensors, is indeed a terrorist) or returns 0 for no (Ex. the IoT sensors indicate that no, this guy is not a terrorist, but he might be a Trump supporter). The cool part that makes it a Perceptron is that this equation is influenced by "weights" or "memorized patterns" in the Deep Learning AI brain of the computer that learned what is considered a terrorist or a Trump support, and what is or isn't that object as far as the connected IoT sensors are concerned, over many, many examples learned during Structured Learning (more on that later). So, here's the Java code given all that:` static int processOuput(int theta, double xWeight, double yWeight, double nodeWeight) { double sum = (x * xWeight) + (y * yWeight) + nodeWeight; return sum >= theta ? 1 : 0; }`That's all there is to it. That's a Perceptron in Java code, and that's how machines can learn and have a functioning brain of its own. Pretty simple at first, but it gets much more complicated when we start to layer these Perceptrons for Deep Learning AI, not just a simple Java method executing a few lines of code. For more information, see Dr Noureddin Sadawi's great set of tutorials on Machine Learning and AI:Dr Noureddin Sadawi's AI TutorialsSo far, this is the basic building block Java code for Deep Learning AI in IoT, so take time to let it soak in. From here, we next will talk about Structured Learning vs. Unstructured Learning, which is actually pretty cool since it can apply to computers, puppies, children, and in the future streetlights, traffic cameras, refrigerators, and TVs... And, hopefully, all those devices won't learn too fast... Or, we'll be in trouble whether you're a terrorist, a Trump supporter, or anything in between... Hinkmond