Okay. So I want to welcome everyone to this month's meeting. Our speaker today is Joey Hess. Many of you know him. He is most well known for his work with Debian, which he did for a very, very long time. And as a Debian user myself, I'm very grateful for all the work that he did. I don't think without his efforts, I would be using Debian. Beyond that a number of years ago, he started programming in Haskell and he's produced a number of very, very valuable software packages that are in pretty wide use in Haskell. And I reached out to him and asked if he would give us a talk. And he said that he wanted to talk about the work that he's been doing on using Haskell to program Arduinos. So with that, I'm going to turn everything over to Mr. Joey Hess. Thank you very much. Okay. Thank you, Claude. So yeah, I'm going to talk about programming Arduinos using Haskell, which as somebody already commented seemed like two completely disjoint topics that didn't fit together. And but luckily NASA has kind of swooped in and made it almost possible. So I'll talk about how I've built on that. And for anybody who doesn't know, I think most of you will. Arduino is a little tiny computer like this. This is a clone. And it runs a very small embedded processor with like 32 kilobytes of RAM and well, I'm sorry, a flash is really embedded and maybe two kilobytes of RAM, something like that. So the problem with running Haskell on such a constrained environment is that you know, GHC and most other Haskell compilers are built to target modern machines. They have a big chunk of runtime that comes along with every program. If you go build your simplest Hello World program in Haskell, it will be like half a megabyte or something of binary. You could probably strip that down quite significantly, but it's nowhere near small enough to fitting on these boards. And even if it was, Haskell isn't really designed to be a resource constrained programming language. Anybody who has written Haskell code and has had a fold L or a fold R and has been like, wait, which of these should I be using right now so that I don't eat up all the memory in the world when I operate over this list realizes that Haskell is not perfectly ideal for controlling your use of memory. It's great at other kinds of control, controlling effects. It's great at types, but memory is kind of its bugaboo. So trying to use it on an embedded system is especially problematic. And also the Haskell runtime itself does a whole lot of allocation. It's constantly allocating new values and then freeing old values. And so again, not a good fit. So I would have said that it was impossible. And that was what I thought when I first started this project. And then I actually did a little bit of research yesterday. Let me start sharing my screen and make sure that works. Okay. Y'all should see my web browser. You got it? Okay. So I did a little bit of research. I found this page that is like seven years old that talks about just this problem. And actually down here under full compilation, it talks about AJHC, which actually targets the ARM Cortex M3 and M4, which is actually the processor that is on some Arduinos. So it's actually been done. I think this project was abandoned. And this is also not GHC Haskell. It's not exactly the Haskell that most Haskell developers would probably want to run. And you're probably still constrained what you can do that. This also gave a good overview that the basic approaches are you're going to have some kind of full compilation or a limited system that you have a very limited subset of Haskell code or a hosted EDSL. Now what is an EDSL? I have a question. Maybe you're going to get to this. Why is it necessary to run Haskell on an Arduino? What's a good question? I'll jump right into that. And I'm happy to take questions. Yeah. I'm sorry. I made a spoken over your little because of my lag, but I'm happy to take questions. And that's a good point. Why am I even thinking about this? So the reason is I do, I live off grid. I have done a fair amount of home automation with Haskell all using ARM computers, which is fine. Running Linux on an ARM, you can write Haskell programs that do things like keep track of how many watts your house is using. If you can see down here at the bottom of my screen or the voltage of your batteries, how many battery percent you have that can do things like automate when this and that turns on and off. But also, your typical ARM board isn't a really robust embedded system that you really can be guaranteed is going to keep working. And I was thinking about putting in a hot water heater. And I was thinking about, well, I'm going to try to program this thing to some extent. I want to be able to at least control when it turns on and off, even though I'm not going to defeat all the safety apparatus that is on a standard hot water heater because I've seen the videos where they come out at the top of a house and I don't want it to happen a month. But I would still prefer to be using a platform from the beginning that is a proper embedded platform. And Arduino isn't perfect in that regard. It's a hobbyist computer. But at least it's a start. And I really have enjoyed using Haskell, though, especially functional reactor programming in Haskell with lots of strong data types, just to keep track of all the complexity of when you're reading from all these different sensors, they all have different units, you know, just stuff like that. So I was sort of thinking about it. And what I realized is, yeah, it can kind of be done using this EDSL technique that this page talked about several years ago. And if you don't know what a DSL is, it's a domain specific language. So you're basically you have a Haskell program and embedded within it is another program. And the idea is the Haskell program is going to write a program that is written in C that then gets compiled targeting the Arduino. So luckily, around this time that I was thinking about this, a guy named Ivan Perez who works at NASA was promoting this project that NASA had developed and released a street software called Copilot. And the idea with Copilot is basically exactly to be that domain specific language. And what they're really actually my understanding doing with Copilot is while they're working, I believe mostly with drones right now, but maybe also with rockets, I can't speak to what NASA is doing internally. But the basic idea with Copilot is that NASA has their regular software that controls their rocket or their drone, which is probably written in C because that's how NASA rolls. And it's probably very complicated. And maybe it's hard to, you know, guarantee that its behavior is completely perfect in every respect. And the idea here is, well, we're going to hang a little thing off the side of a program. And every time we go around our main loop or something, we'll just say, hey, Copilot, could you go check that everything's okay? And it will look at various values that our C program was looking at, say maybe altitude and how much battery is left, stuff like that. And it will do enough calculation to figure out if it needs to take over, you know, if it needs to grab the wheels that were and say, oh no, you know, everything is going wrong. And I'm going to try to get us into at least a safe situation. And so it is just a small little domain specific language. They're continuing to develop it. And when I saw this, and then I looked at actually another presentation from a fellow in, I believe, Australia, or maybe New Zealand named Anthony Crowley, who had actually taken Copilot, used it to build some C code and then manually written the rest of enough code to get that C code to actually do something on our Arduino. So he was still writing, you know, 20 or 30 lines of C, whatever, but at least he could then, you know, use Haskell to generate the rest. So that was cool. But he hadn't taken it any farther. And I thought, well, okay, I'll do this. So I went off and did that in 2020. Early 2020. And this is the result, Arduino Copilot.  And if anybody would like to follow along in the talk, if you go to this page, just look up Arduino Copilot on Hackage. And if you clone the source code, either with Git, or if you just ask Cabal to unpack it for you, you'll have all the examples I'm going to use for the rest of the talk. Okay. So let's, without further ado, actually look at how this looks. So I'm going to be mostly just using existing examples. This is the simplest program that everybody writes, you know, on the Arduino to begin. We're going to blink an LED. There's really not much to it. The LED is blinking. That is like the most important thing about it. And you'll notice there's like an equals colon operator here. And that's just a made up operator that says basically assign whatever the value of blinking currently is, which is either on or off to the LED. And there's also a delay. And the delay just, you know, makes the LED not blink continuous, you know, very fast. And so it's a 100 millisecond delay. Now this program is an Arduino program. And this Arduino, which we're going to call from our main function, goes off, generates the C code for the specification that's inside of it. And then you can compile that C code yourself. So the rest of this is just your typical boilerplate. This is the module that everything is in. And this is the module we're making. And this up here, rebondable syntax I'll talk about later. Okay. But basically it's, it's where they embedded in embedded domain specific language comes. Let me show you how this works. Does anybody have any questions? Yes, I have a question regarding it. Does blinking have any side effects? Because it seems a bit weird that it automatically flips between two states. But then you also need to insert the delay. Right. So the way to think about this is, this is the behavior of the LED. Every time we go through some kind of a loop, basically the Arduino main loop, right? The LED will switch to the next state. So we could make this be a slow blink, like it's on for, I don't know, 150 or 200.  We could do it that way. But we can also just throw in an actual delay, which is kind of easier, because that way if you have a bunch of different things happening, you can keep them all happening at the same rate. And yeah, this does, I mean, this is all side effectal code in a way. We haven't, the only pure code here really is blinking, which is the only code actually written in copilot. The rest of this business here is all Arduino copilot. So we'll get a bit more into doing more interesting pure code in a few minutes. But right now, all we have is the simple function blinking, which is either on or off. And every time through the loop, it alternates, basically. Okay. So if you were to call it two times, then there would be no blinking at all, because it would immediately... If I signed to this twice, that's a good question. Let's see what happens if I do that. I like that question. Let me try to actually highlight this. Okay. So I'm just going to go through the readme file, which says how to build it, which is a bit weird because it's inside anyway. Normally, this would be building it with stack or with cabal in your normal way. So it built. Now we can upload it through Arduino here with make upload. Now, but first let's actually look at the program because what it's done is it's created blink.ino, which is a C program. And there's that main loop that I was talking about down here. Every time through the main loop, it does a step. This is a step. And in here, we start getting code that was written by copilot. In fact, let me actually pull this up to an editor so I can highlight. So this part here was written by Arduino copilot. And then this block in the middle here, all this is copilot just for blink. And you might be like, wow, that's a lot of code just for on or off. We'll get to there in a minute. But and then this is again generated by Arduino copilot. So I just wrapped the copilot with enough to make it work. Now, the nice thing about this example, though, is it's a lot simpler than it looks. You can do a lot of constant elimination and folding and some really basic optimizations that every compiler will do. And you'll get a much simpler program. But let's see what it does first. So okay, so I'm going to make upload. I have my board here. And it started. Now it's still up. And there it goes. Now it's blinking. So I believe to answer your question, and I'm actually not 100% sure since it has been two years since I wrote all this, and I haven't thought about that particular point since, but I believe that it only happens one time. It only, if you assign to it multiple times, it doesn't change the behavior. It's a good question. And it should be documented what happens there and it isn't. So thank you for that. Anyway, so I said that all this gets simplified down. I actually have a webpage somewhere where I went through manually and manually, you know, did all the basic compiler stuff. And it basically comes down this one line. You can see here is the modulus mod two. And that's all the copilot ends up to compile to is this is mod two, and we assign to it and update it every time to the loop. And if you notice here when it built the program, this is the total size of the program 966 bytes, the data is 13 bytes. So it's fairly small. It uses 2% of my Arduino, which isn't a very big one. It's a red board. Okay. Okay. So that's a simple example. I wanted to show something that would give you a little bit more of a feel for how how copilot works, not just Arduino copilot. So this is an example that includes a button. And here we're reading from an input whether we're reading from pin 12. In fact, a but is the button pressed. And then the LED is on when the button is pressed or blinking. So it keeps blinking. But when the buttons press it just stays on. Okay. So this or here is is happening in copilot in the DSL. But also there's a delay and I changed the delay to be longer and longer. So longer and longer is a value expressed in the copilot DSL. And it's a stream of numbers. Everything in the copilot DSL is in fact a stream of something. Blinking is a stream of bull. This is a stream of word 32s. And I basically just took an example straight out of the copilot tutorial that shows how to build a stream that increments and then resets when the stream of bull gets to true. So basically, this just counts up to 64. Well, this just counts up forever. When it gets to 64, it becomes a true value. This other counter uses the inner counter to decide when to reset. And that makes it that makes the delay go up to 64 and then reset back to zero. So I can demo this, but I don't have a button hooked up. But I can still show you the basic blinking effect. You can guess what it looks like. I need to build that other thing. And if all the stream manipulation looked a little hard to understand, it's a little hard to understand for me too, to be honest. I've read the manual and I understand, I can generally get copilot to do what I want, but it can take a little bit of thought. I don't know if y'all can see the blinking effect here, given the limitations of camera technology, but it is kind of, it starts out fast and then it gets slower and slower, and then it goes back to fast. Okay, simple. And if there was a button, you'd see that. Okay, I'm going to turn that over. That's a very annoying effect. Okay, so I have some other demos that show off other things. One that I like to show off is serial port because it shows a little bit more than just read from pin, write to pin. So this is an example that does output to a serial port. And I'm not going to go through the entire detail of it, but if you look here, there's a little bit of setup for the serial port. It also supports XP, which is a wireless serial device. If it happens to be there, it will use it also. And all this program does is it reads from A0, which is the analog input of the board. And I'm sorry, was there a question? No, okay. So it reads from A0. It says what value it read. And that's, and I believe it lights up the LED if there's input on either the serial, on the serial console. So that's the basics of it. The thing I like about this example is that since A0 is just kind of a, on my board, it's not connected to anything, I can actually demo this without any hardware just by putting my finger near to it and changing the value of the ADC happens to pick up out of the other as it were. So let me show you that. If y'all are, if you think that it would be useful to show you this, I don't want to overwhelm you in silly little demos that don't really do much of interest. At least it will stop my board from doing the annoying blinking. Okay. So I'm going to listen to the board to see what it has to say. Figure out where A0 is. And as I run my finger along, where is A0 over here? I think so. There it is. It's over there. So, oh, you can't see. I'm sorry. Yeah, I'm just moving my finger right over on the pins here slightly shorting them out or making there be a little bit of a current there and it reads it. How do you get out of screen? I have no idea. Okay. Good. So does that kind of make sense? I know that that's a lot of stuff I've thrown at you really quickly. The important things are it can input from a pin. It can output to a pin. And also, I didn't really talk about how it outputs this message, but you see here that there's a list of values. And it's basically just creating a string out of them. And some of these values can be like the C can be values that are sketches or streams. Okay. So this is kind of, yeah. You might have shown how did you set what the sample rate is again for that ADC. So we once again have a delay down here. Oh, the ADC sample rate? Yeah. Oh, okay. I'm just using whatever the Arduino default ADC sample rate is. And I think I may need to make that configurable. I was a pretty naive Arduino program when I wrote this and I didn't realize that you might want to alter that. But yeah, it's just sampling for whatever the default is when you do a read. If we look at the code, serial port, let's see, it was A081. I don't know. Somewhere in here it does the actual read. Oh, here we are, analog read from pin 14. That's the entirety of the code that I had it generate for that. So if you needed to do something more complicated, like read for a certain amount of time interpolate or something like that, you would either have to do it write new C code that does it basically or try to do it with copilot with the DSL itself. Does that answer your question? Okay. Yes. Yes. Cool. And maybe I need to revisit that, but I'll get to that toward the end of the talk why I need to. Okay. So the other example I wanted to show you, because this is Haskell after all, and this is also kind of my motivating example is the hot water heater. And the good thing about this example is so far we've only seen basic data types. We've seen bulls. We've seen various kinds of words. Nothing that a nothing to see program wouldn't pretty much have in it. Finally, we're seeing a couple of real honest to goodness, well, almost honest to goodness data types. Now, unfortunately, copilot, the language from NASA isn't it doesn't have like the entire Haskell type system available at runtime. And again, the reason is Haskell's, you know, making Haskell's types all work at runtime would be difficult. Because you need to be able to unpack them and traverse them and whatever. And copilot doesn't do that. And in fact, I wish the copilot did a little bit more with types. And I've kind of hacked this on on top of it to at least have a little bit of more typing. So the reason that these are data PSI and data Celsius and there's not like an equals PSI, you know, like that is that these aren't values, they're just phantom types. And a type behavior PSI float, for example, is the same as a stream of floats. But it's got this PSI attached to it and the compile the Haskell compiler can tell Oh, I'm operating on a PSI, whatever else I'm operating on, if I'm adding to them together, for example, it better be a PSI as well. So it's just basic phantom types, which is something that you can do on top of copilot pretty easily. I won't go through this thing in detail, but you can see that it has some, you know, some values, a maximum minimum water temperature, which are in Celsius. And it has here is the temperature safe, and there's a lift B2, that's lifting the less than which is a copilot operator in this case, into or it's lifting it to operate on a type behavior. So we don't need to unpack everything manually, basically. And, you know, we can also read in, say from an ADC that is somehow connected to, you know, or a value in Celsius, that's probably unlikely, there's actually a sensor that works that way. But if we had one, we could read it this way, or we could read in a value from the ADC, and then use this function to get a type behavior from Celsius of Celsius. And it just does the basic math to convert a raw nominal ADC value into Celsius. There's an unsafe cast here, because we're converting I believe from, oh, I don't know, from something to float and it wouldn't work without it. But it's not actually very unsafe, we're converting between two different numeric types that have the same memory representation. And copilot does, I believe, make sure that you don't do anything really unsafe with it, like between two things that don't have the same memory representation or something like that. So yeah, here we're, you know, we can read from A1 and read from A2, which are the two sensor elements in a water heater, convert them to Celsius, read a PSI, and decide if it's safe to run the water heater or not, and just turn on the different elements depending on the temperature or something like that. So a simple water heater example, actually copilot itself has a some kind of water heater example on its front page, which I thought was amusing. It doesn't have strong types here, it just has floats and words. Okay, I wanted to show you all one more example, which is where it gets a little bit more looking like a non-trivial program. And this is a simple line follower. And if you've seen a line follower from Arduino, this pretty much looks like every single other one. The thing I wanted to show is that you can use if, then, else. And now this isn't like your typical Haskell if, then, this is lifted using rebindable syntax into various, well, this is in what's called a sketch, which is Arduino copilot's idea of what an Arduino program is. So we're assembling together little sketches like this one that stops the robot, this one that goes forward, turns left, turns right. All these sketches are getting composed together here to decide what to do, and it's going down the line and reading from two sensors and swerving left and right is needed to stay on the line. Pretty typical little thing. I've never actually put this together with actual hardware, so it's all just a general idea of what it would look like. The other thing I wanted to point out is that you might notice there's some code duplication in here. This is basically the same function two times with a few minor differences. And you could totally refactor this at the Haskell level and make a function that took, like, a direction and say, you know, left and right and do like this, do like that, put your direction in here, you know, you know, like this, you know, that do something like that. And so you can pretty much do normal Haskell programming without much real thought about it. If you're a Haskell programmer, this is all pretty natural. You would just refactor stuff like this to eliminate the duplication. I left it in to keep it simple. And I'm going to build this but not run it, because I don't have the hardware. But I wanted to show you the size of this little example. Once it gets compiled, I'll just build it into an Arduino binary, but I won't upload it. Oh, I must have skipped a step. That's what happens when you forget the step up here. Okay, I guess I've lost something else. Well, that's what happens when you do too many demos, I guess. Anyway, this, I guess my point, I'm sorry that I'm not able to show you that, is that this compiles into a fair amount of code. A lot of it is generated by co-pilot. And it's really not too optimal. All those if-thens under the hood aren't the most optimal representation. They don't get compiled into the most optimal code. And that's really the first time that we've seen this, seen that problem in these examples, I think. Okay, so I think we've had kind of enough examples. If anybody has any questions about you know, Arduino co-pilot or anything else that I've touched on, be happy to answer them. If not, I can show you some other cool stuff. Have you seen any other languages that have been sort of created DSLs or things like that that convert to co-pilot or use co-pilot to push to Arduino? No, I haven't. And I mean, co-pilot is a high school library. So, hmm, but I was wondering if anything I may touch on this later in a minute. But what I was thinking you might be asking is, have you seen any other functional languages that can compile to the Arduino? And I have. Rust can compile to the Arduino. And I haven't, I haven't written anything for it. I've only briefly looked at it. Obviously, Rust is a much better suited language for programming on Arduino in general. If you want it to be like banging on a serial port, you know, to do output and you have to get all the timings just right, something like that. This is still a little too abstract at the high school level to be doing that. But you could write that in Rust. My understanding is you tend to get into a slightly restricted subset of Rust, which makes sense. And you probably want to avoid anything that allocates much. A nice thing about co-pilot is it always allocates a fixed amount of memory. So, your program is always going to use the same amount of memory. It's, I believe that it's guaranteed to not go into infinite loops except for the one that it's stuck in all the time, obviously. You know, it's got some pretty good guarantees. It also has, NASA has built some things on top of it, something called co-pilot spec that, or co-pilot proof, I forget which, that lets you do theorem proving about your co-pilot. I believe it's co-pilot's proof. It lets you do theorem programming using maybe a SAT solver or something. I haven't looked at it, but it lets you prove theorems about your program, do things like that. They also have, I believe, a new project that lets you do some kind of a GUI to build a co-pilot spec. And all that stuff would work with a reno co-pilot, I suppose. I haven't tried to do it. So, that's cool. You just asked, yeah. Any other questions? I'd like to ask about, I will just go ahead. You ask afterwards. So, I would like to ask if you have looked at Clash and how does it compare to co-pilot? Because Clash is also a DSL written in Haskell, right? I haven't really looked at them. This Haskell embedded blog, which I only actually found today and I wish I had known about earlier, does have a few, it has a resources page somewhere with several different DSLs. I know that Galois had a DSL or two that they wrote that are targeting embedded systems or maybe could be used for embedded systems, at least. But no, I haven't looked at anything else. When I found co-pilot, I was happy enough to actually get something that worked and I haven't actually built my water heater yet. So, but I was at a conference recently and I believe it's the Executive Director of the Linux Foundation mentioned a project that I was like, why have I not heard of this project? And that's where we get over into Zephyr.  Zephyr is a real-time embedded operating system that targets something like, I believe, yeah, 350 different boards, embedded boards. It's kind of targeting to be a platform that any kind of company that's trying to build an embedded board and just wants an operating system and Linux won't do because it's too big, can go use Zephyr and Zephyr has developed a lot like Linux. It has threads, it has device drivers, it has networking, it has a device tree, but it all targets fairly small embedded boards. So when I found out about this, I was like, well, gosh, can I run co-pilot on Zephyr boards? And that was two weeks ago and so here's Zephyr co-pilot. So all I did is I took Arduino co-pilot and filed all the Arduino edges off and got something that was, you know, fairly general purpose, refactored that out and then built Zephyr co-pilot and now Arduino co-pilot on top of this abstraction that I came up with, but yeah, this is very, very similar to Arduino co-pilot, right down to pretty much all the functions and everything. Actually, you know, I've skipped one thing about Arduino co-pilot that I did want to show you, which is that it has a library for each board in it that is supported. Currently, there's only two of them and you don't have to use these libraries. You can just import co-pilot to Arduino and then write to an LED or something, but most of these examples have been importing a specific board and the advantage there is you get all the pins and other information about the board. So then and also I wanted to point out that these pins, which are a type pin, but they have a, this is a Haskell syntax for a type-level list of types. So digital I.O. is a type, PWM is a type and this board module knows what the Uno is capable of and which pins can do pulse width modulation and which ones can't. And actually, if I go back over here to the robot, let's see, I think it was the line sensing problem about wheel motor. Okay, yeah, let's switch this to pin four and pin five, right, and build that and see what happens because, you know, you could just be picking random pins and be like, I'll wire up the robot later. Well, the nice thing is since we're using this module that knows which pin is which, it actually says, oh, you're trying to use a pin for pulse width modulation, but it doesn't support it. And this is a Haskell type error message and I've overridden the ugly message with a pretty one. And yeah, so you get a little bit of strongly type programming there. I'm sure there'd be a possibility to do a whole lot more. Anyway, the reason I only have two modules is I haven't bothered to research what all the pins are of the other ones. And if anybody has an Arduino, and they want to add one more, you know, a module for some other piece of hardware, you're more than welcome to do it, I would be happy to help out. Or even if you have one that you just want to me to test, you know, I'd be happy to just throw some code at you and see if it works properly, something like that. It's easy to do. Very simple code to make those board modules. Anyway, Zephyr Copilot, the reason I mentioned that is it only currently supports two boards, which are just the two that I had happened to buy first. I'm not going to buy all 350. And these boards that I picked were from Adafruit. Here's one of them. It's the Feather Board. It's kind of smaller than the other Arduino board was. And this thing is probably a lot more powerful than the Arduino. I believe it has about half a megabyte of flash or something like that. And I thought I'd just show you a quick demo of Zephyr just to, you know, we'll see that it does basically the same thing. I'll go ahead and jump directly to the Feather one if you don't mind, just to save completely overloading everybody with demos. So this is, again, simple Copilot program. This time we're using Copilot Zephyr board, Arduino foot, our Adafruit Feather. And we have an input from pin nine. And then we have an LED that is lit if that input isn't connected. And we have some various other pins that are blinking. These pins are blinking in a different frequency. So somebody asked earlier, why isn't blinking controlling the frequency? And it could be. It could just be frequency two is all that is. So yeah, this is like what I used to test that this board module basically worked. And I haven't implemented everything else. I don't have analog to digital converters or pulse width modulation or serial output, yeah, or serial input or threading. I mean, there's, you know, Zephyr has a huge amount of things that I could add. And I doubt I'll ever add them all. But I wanted to at least show you how this looks when it builds. So we'll run this and we'll get a program. Oh, it's in generated now because Zephyr needs a fair amount of like cruft. So it needs to turn on GPIO when it builds its kernel. It has, this is a device tree overlay that Zephyr copilot has generated that defines all the pins that it needs for this particular program. And then here's the generated C code, which gets a bit, sorry, let me highlight again, this gets a bit grody looking, it's digging around in the device tree at compile time to find the different pins that it's using. So this is a lot of boilerplate that doesn't really do much at all. And then here's your, here's our copilot block. And then down here is the actual pin setup and reading from the input and so on. All right. So if I go ahead and build this, yeah, I've already got the right command line. I'm going to use this other terminal because Zephyr is kind of hard to get all set up and in your path easily. So it's building the whole kernel basically, we put up here.  So a bit bigger, but almost all of this is a Zephyr operating system. And it's using 32 kilobytes of ram also mostly the Zephyr operating system, probably. Now we can flash this to a board. I'm going to plug it in. Hopefully, please let me know if my mic goes out at this point because I have no idea what's going to happen when I plug in another board. So okay, I have a board plugged in. I think I need to put it into flash mode by hitting the reset button a couple of times. Let me see. Yeah, there we go. It's in flash mode. And now it's running or it probably is running. Of course we can't tell because this is not hooked up to a pin, is it? There we go. Now we're getting some action. I hooked it up to the, I hooked this wire up to the pin, one of the blinky pins. Here's a slower blinky pin. I'm sorry, you can't see it. Slower blinky pin with the wire hooked up to it. I just used this to test that I had the right pins. It all worked because unfortunately to implement that board module, I had to go look at the data sheet for the design for that particular board and figure out which pins were hooked up to what. Actually let me, wrong. So I had to go in and figure out that I need like port A11 for pin zero and port A10 for pin one and so on. It's still not very hard to write, but I did have to scare the schematic for a while. And unfortunately, Zephyr doesn't seem to define things like GPIO pins for every board. It often has an LED and maybe a switch that's on the board. And that's about it. And in fact, I wanted to show you the blink example also. I'm not going to run it, but I'll just show it to you. Same code that you saw at the beginning except a different import here. And if you build this and flash it to a Zephyr board, it's using the generic board. So it'll work on anything that has led LED zero, which is a kind of standard name that Zephyr has. And the neat thing about that is that here's the boards that that Haskell program runs on. It's something like 200, I don't know. So and yeah, that's pretty much all I wanted to show you, but I would be really happy to take questions and talk about it further. Great. Thank you so much. So yes, let's open up for questions. I have a question. I'm a little bit more familiar with Scala and its effect systems, where it keeps everything pure until the last moment where it actually does the impure part. Does that make sense in an embedded environment where you you just really build a program to actually set all those LEDs and do all those impure things? And then the last bit is, I mean, or is it just takes too much RAM and resources to do that separately? Yeah. So the way to think about this is I've showed a couple of examples of the generated C code. And there's always a co-pilot block in the middle that's a bunch of gobbledygook. All that code is in fact, essentially the pure code. Now, obviously, it's been compiled into C, and the C is assigning the variables and maybe mutating them. But the Haskell code that generated that particular block is all the pure code. And most of the examples I've shown have been very impure, because of course, we're just fiddling around with pins. And we're reading and writing, and we're trying to we're trying to affect the outside world. And obviously, at some point, you get to the impure code there. However, it's not like this, you know, you saw main equals Arduino do and then some look like impure code. But that doesn't go off and run IO immediately. It's running on your computer. It's in fact, generating a co-pilot spec, which is a data type. Co-pilot is then going off and looking at the spec, checking maybe that it's sane in various ways. I don't know. It's trying, it's working on compiling it into the C code. So everything up until that point is in a way pure on the Haskell side. Now, once you get down to the C side, I don't know that just down to the C side. Once you get down to the C level, I don't know that, you know, the purity matters, particularly. But you can certainly write pretty large amounts of co-pilot code in streams, you know, manipulating streams and stuff, and it will all be pure code. Did I answer your question? Yeah, thanks. I have another question. So this is written somewhere in NASA, just offhand, is that NASA Houston or could we talk to those people? Yeah, let me reshare my screen and show you their page again. So, because they have the details here, where to go? NASA Langley. Yeah, I think it'd be great if you could get, if you get even Ivan or even Perez, who is I believe the lead or one of the leads on this project to speak, because I'm sure he could tell you so much more about the Stream DSL that I have no idea about. It seems like a really neat project, all the things that are doing on top of it, although so far it says monitoring test flights to drones. I don't know if any spacecraft are going to be running this. That would be really neat. My final question is do future bugs lead to your cabin exploding with a bad water heater? No, because I'm not going to defeat the safety that's built into your typical water heater. It will be completely by the book installed, and then we'll have things added on around it that further decide about whether I have enough battery power to heat the water yet or things like that. So, I'm planning not to have a water heater launched out of the roof of my cabin through my solar panels. That would probably be bad. What's your network connection? It is a VSAT satellite link right now, and I have a minimal off-grid system consisting of four solar panels that can produce one kilowatt of power, which is not very much. You can see down here that my house is currently drawing 130 watts of power for the lights on the internet. That's pretty typical. You're not a Starlink customer with the power draw for Starlink? I only wish because the power draw is less for Starlink. I'm currently paying about 90 watts for the internet. I think Starlink is down to 50. They haven't shipped my order yet. Well, you're not in the winter. I thought in the winter it took 130 years. Oh, you might be right. You may well be right. I haven't seen that detail for the newest model dish yet. I'd be curious to know. What state are you located in? I'm in Tennessee. That's what I thought. Okay, great. Moving the dream. Yeah, that's cool. I should add that my day job right now is writing Haskell code. I wrote something called GetAnX, which is a Haskell program that lets deal with large data in various ways that it turns out a bunch of scientists have found useful. A bunch of computational neurologists and people like that are funding basically a lot of my work on GetAnX, which makes it possible to live in a cabin in the woods in Tennessee. Okay, I have to ask what's between a neuroscientist and a computational neurologist? That's the word I was looking for. I'm not a scientist. What do I know? So it is neuroscience, not neurology. I think it was a specialty in medicine. Right. It's a whole lot of MRIs and then processing them using a whole lot of code, is my understanding. Any other questions about co-pilot before I stop the recording? Go ahead, Rashad. I was just going to ask because I wasn't sure if I missed it at the start of the talk, but what other kinds of tools do you use for home automation besides Arduino? Do you write those in Haskell, too? I do. I use an embedded or an ARM box running Linux and I use Haskell on that. I actually use something called reactive banana, which sounds like a wonderful thing to automate your house with. It's a functional reactive programming system for Haskell. I realized, well, I can just read from sensors and write to switches and stuff instead of reading from mouse and writing to the screen. It's all the same, really. Functional reactive programming, I find is a good way to deal with these effects that isn't really, it abstracts it away a little bit and lets you deal more with pure values. And Arduino co-pilot, while I would struggle to say it's actually functional reactive programming, when you look at these things where you're reading from pin A1 and then you're doing some computation and assigning that stream value, which is a varying value that varies over time, to a pin or to something else. It looks a lot like functional reactive programming to me, although I think that a purist would say that there needs to be a continuous function or something like that. But anyway, I've used pretty much exclusively reactive banana to automate my house. Awesome. That's another talk. Yeah, that actually kind of answers it. Yeah, I may be switching over to Arduino's because keeping these armboards up can be a little bit tricky. USB tends to glitch out or power fails or something. Now somebody else had another question, maybe. Yeah, no, you actually kind of answered my question. I was just going to ask about how FRP is kind of utilized in co-pilot Arduino. But I do have another question, if you don't mind. It was just about the input function that I saw you use and some of the do blocks and some of the demos. And I noticed you were passing I missed the name of the function that you said. The input, I believe it was called input with an apostrophe at the end. Oh, yeah, yeah. Oh, good example. Oh, I mean, good question. Let me look at an example. I skipped over something interesting. So this could be as simple as input from pin 12, right? And this you'll probably just write it as like the reason that it's written this way and it's a neat little feature of co-pilot is that if I run this thing, but I don't actually tell it to output C code, instead I pass C5 or maybe C4. Let's see. Oh, dash I, I4. What this is going to do is it's going to take those input values that were provided as dummy input values. And it's actually running the co-pilot spec on my local computer, not on Arduino. And it's saying, here's what's going to happen at the different steps of that thing. So here's what it's going to write out to that pin based on the input values. So the nice thing about that is, yeah, here we are. So false, false, false, true, true, false, true. It depends because it's blinking, of course, so it's on and off anyway. So I don't know if this actually demonstrates what it's doing, but you can, you know, you can use this to just simulate something before it hits the actual hardware and see what happens. And I've actually found this pretty useful when we get over to working with eProms, which I haven't touched on because it's a pretty complicated API. But we do have support in Arduino co-pilot for eProms. You can write values to them and read values from them. You can operate over a range of values and change to a new value each time you could use for data logging or something like that. And I really found this input really helpful there in this simulation, very helpful because I could see exactly what happened at every step to every eProm cell. So, you know, for that kind of thing where you need to really look at your program in detail and you don't have it a debugger for the Arduino, obviously, well, maybe there's one, I don't know. This is a really nice thing that's in co-pilot. And so a lot of the examples that I have do use, I don't know, yeah, here's one, so dummy clock input even. It's inputting from, it's inputting the current time, but then it's dummying up the various time steps, for example. So, yeah, I use that a lot, just to understand what's going on. And it's a great feature of co-pilot. Yeah, and I was also going to ask, I guess the answer would be, I'm going to guess that it's no, but could you pass an infinite list into... So, while these stream values that co-pilot uses, let me go back to the button example. So, it's a stream of word 32. What is this thing actually? It's not an infinite list, but you could think of it as an infinite list because, you know, just think of it as an infinite list as being garbage collected without any garbage collection, because obviously there's no garbage collection running on an Arduino in two kilobytes of memory. But what it actually is, is the current value of the stream at every step depends on the co-pilot program. So, you can think of it as an infinite list, but there's no actual list happening here. And co-pilot does support some C structures, and it supports arrays of fixed size. So, you can have values that are like a stream of... I'm not sure what the syntax is because I've never actually used it, but it would be something like this, but not this. Probably a stream of some size array, array size three or something, like probably something like this very vaguely. If you want to know the details, you could take a look at the co-pilots documentation. They have a manual, which is pretty decent to get an idea of... Here's the manual, to get an idea of how the streams actually work. Okay. Or you can read the C code, which is also pretty easy to understand if you look at a simple example, and you'd be like, oh, so the stream is just modifying this value. Okay. Interesting. Thank you. Yep, that's all. That's all the questions I have. Oh, these are great questions, guys. Thank you for them, David. These streams, from the perspective of Haskell, like IOMONAD sort of implementations or... Yeah. Normally in Haskell, yeah, a stream would be some kind of infinite list, probably, or something vaguely similar to an infinite list. But since co-pilot isn't actually running the Haskell runtime system, it's compiling... It's generating C code, which is very simple. It doesn't have access to lists. It doesn't have access to laziness. It doesn't have all the things that the Haskell runtime uses to do these structures, which is why it uses a simple stream abstraction as its main data type, as it were. So I actually have one more question, because we're talking about memory and stuff like this. So recently, I'm sure you know, Haskell has recently gotten linear types. Could that somehow be utilized in co-pilot somehow, or does that offer anything? That is a really good question. I bet it could be used in co-pilot itself. In Arduino co-pilot, I'm not... I'm sure there's something, actually. I haven't thought about it. It's a wonderful question. I would be curious if the co-pilot developers have thought about it at all yet. It might be worth looking around in their issues and seeing what they have. You know, maybe they can give better guarantees about their programs. Sorry. I'm hearing myself echoing back on something. All right, last call. Any other questions? I mean, we'll continue the discussion after I stop the recording, but anybody want to get in a question before? Okay. I saw you use Rebindable Syntax. Did you think about Qualified 2, which was added in, I think, GC9? I guess, since this is just a syntax transformation, both of them would work, but Qualified 2, I guess, would not really offer anything because you always only have one monad, right? So you don't really need to specify which monad you're talking about. So I don't know if I actually understand Qualified 2, to be honest. The use of Rebindable Syntax is mostly by co-pilot and not by Arduino co-pilot. What it does is it's what's letting you say if foo then bar and things like that for people who don't know. Basically, co-pilot throws out a lot of the Haskell preload and then re-implements it with its own version and uses Rebindable Syntax to get as close as possible to what looks like natural Haskell programming even though you're not using the normal data types or anything like that most of the time. And Arduino co-pilot, it does have a monad, which is of course where the, you know, read from this right to that happens isn't a monad. And it uses Rebindable Syntax only also for if then else, which it has its own implementation in that monad using Rebindable Syntax. But yeah, I don't know about Qualified Do's application here. Sorry. So I think I'm going to stop the recording now. Before I do, I want to thank Joey so much for this talk and the discussion. This was really, really fun and interesting. And we'll continue discussing in a second. Well, thank you, Claude. I appreciate the opportunity and I've really appreciated all the questions, some of which are made me think. So I really appreciate that. So thanks to everybody who showed up.


Greetings, friends at Lightning Lab GovDec. This is Oji Tang, Taiwan's digital minister. I'm very happy to be here virtually to share with you some thoughts around cross-sectoral and international collaboration. In Taiwan, we always believe that digital transformation happens in the civil society. The civil society is great in recognizing actual social needs. And the private sector can also introduce the cutting edge technologies and know-how of how to solve this in innovative ways. Combined together, the public sector's role is rather one of facilitating and providing sufficient data and political will for the innovation to happen. This idea is called forking the government, taking the existing service, proving a better way, and then merging back into public service. A few months ago, our presidential hackathon organized by the president's office. It's not just a two-day or three-day hackathon, it's actually three months, and structured much like your accelerator program here. In the end, more than 100 proposals came together and we selected five teams and imbuing them with the political will and support of the president's office to use cutting edge technology to solve pressing social needs. Water Savia is one of the five teams. It's born at the Taiwan Water Corporation. They're solving a problem that is increasingly serious worldwide, water loss from urban distribution systems due to leakage. And they use the internet of things and machine learning technologies to detect and predict leakage in water mains, leading to reduce water loss and much faster repair times. The team was comprised of the Water Corporation and a data scientist from the administration, as well as from people in the civil society and academics and even graduate students. And together they have successfully deployed their solutions in Taiwan and they're now looking to deploy in other jurisdictions worldwide. So we're very happy to have the opportunity of lining up GovTech to implement the solution in New Zealand as well as exploring new markets, business models and methodologies to help promote better water resilience worldwide, which is one of the very important sustainable development goal. Two team members will be resident in your accelerator in Wellington full-time, including Dr. Huang Li-jin, a data scientist with a PhD in computer science from the Department of Information here in the Taiwan administration. And so I look forward to what more collaboration in the future and using the sustainable development goals as our compass. I am also committed to surface more social innovations around Taiwan as well as building more international connections. Thank you for listening.


They'll show their colors their true colors immediately But this is what we've come to expect from the Republican Party So when it comes to states rights and voting, you know, I don't know if you all know about this But we're currently in a pandemic and we have a major election coming up in November So assuming that the pandemic persists until that time voters have to be given some alternative They can't be forced to risk their lives to come out and vote in a pandemic So of course, I think that mail-in voting is a no-brainer. We do it in Oregon It's been this way for decades. Everyone here loves it Republicans and Democrats But California governor Gavin Newsom has chosen to institute vote by mail and the Republican Party is suing him You heard that right. They are suing him for choosing to do vote by mail During a pandemic. I mean never mind that this should be the norm Even if we're not living through a pandemic But the fact that they're suing him for instituting vote by mail during a pandemic adds to the absurdity of this story So as William Cummings of USA Today reports the Republican Party launched a legal battle to block California governor Gavin Newsom From sending all voters in his state mail-in ballots for the general election arguing the move is unconstitutional and invites voter fraud the Republican National Committee National Republican Congressional Committee and California Republican Party Fought a lawsuit Sunday against Newsom and Secretary of State Alex Padilla in the US District Court for the Eastern District of California In their complaint the groups called the Democratic governor's action in a legal usurpation of the legislature's Authority to set the time place and manner of the election which they said Constitutionally rests with the state legislature. This brazen power grab was not authorized by state law and violates both the elections clause And electors clause of the US Constitution the complaint says on May 8th Newsom signed an executive order stating that every registered California voter would be sent a mail-in ballot because of concerns about the spread of Coronavirus elections and the right to vote are foundational to our democracy Newsom said in a statement No Californian should be forced to risk their health in order to exercise their right to vote So I mean there's so much to say about this but let's just pause for a moment and think about their Republican Party and what they View is you know an abuse of power or a power grab whatever language they used. They're perfectly fine with voter ID laws They're perfectly fine with restricting the number of polling places in precincts. They're perfectly fine With legally questionable voter purges in states like Georgia and elsewhere But when it comes to a governor Signing an executive order that allows citizens to vote by mail during a pandemic. That's where they draw the line That's an unconstitutional power grab and understand They don't have much of a leg to stand on here because they constantly cry voter fraud Trump does the same thing But they can never prove it They never present you with evidence and that's because there is no evidence that vote by mail invites mass voter fraud Which is why they use language like it invites voter fraud because they can't actually prove That it is conducive to voter fraud if you go to the Heritage Foundation's Election fraud website you can look at each state and they basically Will catalog all of the instances of voter fraud go to Oregon and there's less than 13 over the last 20 years So clearly they can't prove that this will lead to voters fraud which is why they have to fear monger and say oh You know, it'll invite voter fraud. We're not saying definitely, but it just opens the door to voter fraud more so than machines how they don't have an argument and Understand that they're basically trying to get him on a technicality This is a very you know democrat tactic. They're trying to say well, you didn't fill out the proper paperwork You know you did this via executive action Whereas if you did this via the legislature and got it passed that way then we'd be okay with it We're not against vote by mail because that would encourage more people to vote Which means we'd probably lose or against it because you didn't do it properly you signed an executive order and we're against that We're against power grabs.  Let's be very real about the intentions of the RNC and the Republican Party Here's the thing if more people turn out to vote that hurts them every single time because the Republican Party is a minority party Most people the overwhelming majority of Americans do not identify with the Republican Party so they know the only way that they can get power and maintain power is by disenfranchising thousands and thousands of voters and of course a form of voter suppression is Forcing people to vote during a pandemic and if more people have an option to vote Then that means that they may not be as successful They don't care that you know, they're well winning illegitimately They just care that they win and make no mistake about it This isn't just about California because I think that they realize California is a deep blue state and to them It's lost cause but they don't want the popularity of mail-in voting to catch on because if it does and if every single State had vote by mail if we had nationwide vote by mail, could you imagine more people would vote and when turnout is higher? Republicans lose this is a Fact of reality every single election we can basically If we knew how many people would turn out to vote you could predict with a relative degree of certainty Which party would win and take power? So the Republican Party always tries to concern troll as a way of disenfranchising voters, right? They say we need voter ID laws to you know, diminish the prospect of fraud We need to make sure that we don't do mail-in voting because that could lead to people committing fraud When in actuality, what's the outcome of these policies that they implement? I mean look at voter ID laws these Disproportionately affect black and brown voters So, you know if they're going to disenfranchise voters at least Stop with the facade stop with this, you know pretense that you actually care about, you know integrity at the vote Because that's not what you care about you care about winning And so if you can disenfranchise democratic party voters and get them to not turn out for Democrats Then this means you would win It's the only way a minority party is able to keep being successful aside from the fact that you know The opposition party Democrats suck and people don't want to turn out anyway, but if more people turn out Republicans lose so I mean this is just it's a despicable move, right? And if I were Gavin Newsom currently not knowing how this is going to pan out I would encourage, you know Democrats in their state legislature to pass this law and you know codify it send it to his desk Because I think that you know signing an executive order is an important measure to take, you know But you also have to make sure that you make this a law so it's permanent so it can't be challenged I mean that doesn't necessarily mean that it can't be challenged That's not to say that Republicans still wouldn't challenge it But as many arguments from them as you could debunk that's gonna help, you know bolster your case because mail-in voting is Incredibly important and regardless of what Donald Trump and Republicans say they're lying They're absolutely full of shit when they say that this leads to voter fraud because that is demonstrably untrue and if they actually cared about voter fraud they can have Policies enacted to where they audit the votes at every single precinct at every election have a recount just automatically be triggered If an election is within two points, right? If it's a close race There are things you can do to minimize voter fraud, but it's not that big of an issue they try to make it a big issue and you know right wing media Sensationalizes this issue because they want to suppress the vote and you know claiming that there are Widespread instances of voter fraud across the country. That's just the justification that they use To try to disenfranchise voters don't fall for their bullshit and fight them because voting is a right And once you lose that right in a democracy then you no longer live in a democracy You can argue about how much impact your vote has But if you lose the right to vote if there are more obstacles that keep you from voting You no longer live in a democracy and you can already make the case that we don't live in a democracy I would argue that we don't live in Democracy or we don't meet the criteria of polyarchy, but the right to vote is essential Don't let Donald Trump lie to you. Don't let the Republican Party lie to you. They are full of shit They don't care about voter fraud if they actually were concerned with it They wouldn't be pushing voter ID laws or stopping people from voting by mail because again, it works in Oregon We've had it here for decades and Republicans and Democrats here love it and if you try to take it away from us You're gonna have a pretty hard time doing that, right? Even Republicans here absolutely love vote by mail So this is just a tactic.  Please don't subscribe to him or become a patron David Dole is so much better. Trust me folks. He's doing a great job. He really is okay


Cool. Thank you, Michael. Um, do apologize. Um, obviously this is a very late switch up. So if everyone was like anyone was like Expecting to learn how to submit themes. Um, this is this is a different talk Quick background. So we're talking about creating a lead mean lead generation machine Go easy on me. This is a fresh Presentation haven't done this before but let's get going. So just a little quick intro about me So my name is Robert. I'm one of the solutions engineers at WP engine So in terms of my background Michael's already gone into WP engine But my background I've started three startups and exited one. I love my little dog. Her name is Chelsea I like basketball and go for like a team that never wins and I love to making WordPress do crazy stuff and break so Cool and gender of this talk is whoop is about Firstly when we're talking about creating a lead generating machine, we want to understand, okay What are we talking about when we're creating a lead? What does the lead mean? How does that impact your business? Like what are the steps that go towards like that lead turning into something that's actually valuable? Um, so we want to understand the funnel first. We also want to understand, okay What do we mean by sort of push and pull marketing? There's a very basic sort of concept of marketing I'm sure a lot of you here have more sophisticated ways of understanding it But obviously this is a beginner sort of talk And then we're going to talk about like some possible ways of Leveraging this kind of model So I was in like understanding social media and content marketing to kind of build on that initial outreach And then talking about sort of lead generation and nurture So things that you can do to kind of turn that person who's found your content interesting Into someone who's willing to actually do business with you And then because I love automating everything because I'm super lazy Figuring how to do that. Okay awesome So I just want to start by saying this is good for small business owners or traders and freelancers small creative agencies And anyone who's looking to do sort of growth focused Growth focused who are growth focused on the business, but they're a little bit time poor So this is going to be for some people pretty simple for others. It may introduce new things. Hopefully get some value out of it So the first thing I want to talk about is understanding the funnel now Who here Has kind of created a sales of marketing funnel before Whoo You guys are awesome. There's like 10 hands. Awesome. Great. Um So basically it's it's a visualization of the customer journey. So you want to understand, okay How do they first interact with your brand? Okay, how do they understand it? What is the messaging behind it and then going through each step to get them from becoming like let's say Understanding a brand to kind of being interested in it to purchasing whatever it is that you're offering and then to becoming advocates of it So as we grow, you know, and this is especially in the case when I started Oops Especially the case when I was doing startups and like creating products that no one had ever heard of and they were like Who the hell is this guy? um I used to Say run around trying to do sort of day-to-day things. I was really unstructured about the way I was doing things I was just trying to generate business and hustle because I was like, hey hustling. That's like cool But like if you hustle without structure, you're just expending energy for no reason and so Without understanding what the structure is that you're using when you're hustling it's really hard to iterate on it It's really hard to improve if you're like, okay Well, how how like how much time can I shave off running between appointments and stuff like that? That's not that's not useful, you know So the only really good way to understand how to kind of optimize that is by kind of mapping out that journey and creating a funnel I see a few of you are taking a shot of that. That's a very basic sort of sales and marketing funnel So it's a good one to start with But it allows you to understand, you know Like the metrics for or understand what sort of metrics you need to create for defining when someone has become interested You know instead of kind of just filling it out or when someone is ready or has signal Sort of buying intention instead of kind of just going they view they look like they might want to buy Um, and so like it gives you like some metrics that you can improve on and iterate and growth grow your business So the first concept I want to go into it's very simple Um, I'm assuming most people have heard about the difference between push and pull marketing who here hasn't Everyone has heard about oh you awesome. Um, Michael. That's interesting. So So push and pull marketing is is really simple. It's just about understanding. Okay Um, where is the direction of that message coming from? Are you pushing it to a broad spectrum? Or audience or are you creating content which is engaging so that people are wanting to actually engage it with themselves? So pull marketing bringing people towards it Neither is better than the other I would say so it's important to kind of deploy them at different points Within the funnel to achieve different things. Um, so we're going to pick on a couple And hopefully I'm going to be able to provide you some actual insights that you guys can deploy today All right first one social media. Okay, awesome so social media obviously Everyone uses it. There's a huge amount of eyeballs as of 2019 Users spend 15% of their time awake On social media, which is like when you think about it like instead of thinking about how many Viewers you get how many visitors or how many users are on that It's a huge amount of screen time and a massive market to play with and so it's a really easy and cheap one to start with and so For example, one of the things that you can it's it's really great about developing brand awareness as well It's a form of sort of push marketing One of the I guess techniques that is potentially useful that maybe you guys can look at exploiting is called ingredient marketing So just to give you an idea of how that works. Does everyone know intel? Yes, no one does anyone not know you tell you don't okay, so intel is like a Basically a cpu manufacturer and prior to sort of the 1990s They went very well known out of sort of professional circles And the way that they kind of built their brand awareness They actually increased the brand awareness from 24 percent So when they surveyed a group of customers to 94 percent was simply by like adding like a sticker to every pc So now it's like super it's it's super well known as you can see very few people don't know about it And so it's a really effective way to Market they're always lurking and basically over that period where they were able to increase their brand awareness Okay, they saw a four times increase in revenue And so brand awareness really does correlate to like the business that you're trying to build Oh This was um, there's some metrics that who'd suit have done just recently I believe like just at the start of this year So these are super recent the only reason why I kind of wanted to point this out Is it kind of demonstrates to you kind of the size of each market we're working with feel free to take a picture It's really useful The key thing now with social media as I mentioned It's it's really an intrinsic part of the human digital identity And so unlike other platforms which can seem really impersonal In the way that it works. Um, these are intent usually people who are using these Use it in intense intensely Personal ways and so oftentimes when you're engaging with them on with push marketing with kind of Presenting sort of say a message That that perhaps like might interest them They engage in a way that's like a little bit more personal than saying coming in a bit guarded because of the platform that they're on And so you'll find that a lot of the people on here are typically really sticky So that means like things like for example content Like for example creating white papers or like videos and things like that people actually watch it Okay, because they don't have that pre Uh preconceived notion that they're basically being sold to I'm gonna throw I'm gonna basically focus on the largest Platform on there, which of course is facebook Um, and basically what I want to be able to do is after this kind of show you three really simple best practices That I think everyone should be observing When they're using facebook making sure they're using them in using them in a consistent manner to be able to Consistently grow their brand awareness on social media Um, so the first one and these are specifically from facebook So these are not a secret, but if you haven't seen them, you know There are something that you want to make sure you're always observing you're always thinking about when you're doing anything Um, so first one is obviously keep posts short and specific You want to be really specific about the message you want to communicate? Um, and the reason why I say this is not just because some marketing guru said it We actually did a study with I believe it was advanced genomics. Is that right mark? Where the gen z study what was it called? Yes, but Yes, the center of something generational kinetics. Um, and basically what they found was that um Millennials have a 12 second attention span Right, which is cool. You know because gen z Which is the most recent generation as in people who are like now attending university and stuff Who engage with these platforms as an eight second attention span So this is a trend that's continually decreasing. So in terms of attention span, you only have about eight seconds to work with before you lose You know, they're uh, they're they're buy-in basically. So it's it's really That's the reason why it's really important to keep kind of posts short and specific Um Pictures are really good. Uh, you want to post frequently and timely. Um, I think this is really um, Also a best practice. So obviously with the amount of noise generated these days in terms of content There is more content developed around the world within two days now Then like your grandparents would have consumed in their entire lifetime So how do you stick out from that and there's no really like one Magic bullet and this applies to not just social media, but any sort of form of like marketing where you're involving content Um, you want to to be consistent and you want to time it correctly for maximum impact and you want to keep doing it Over and over again. We typically find the best times to post are Like based around the workday for our particular industry It may be different for your industry So something I always recommend is to understand your customer by doing sort of Focus testing groups asking them the right questions about like when do you view like social media and stuff like that? Um, so we find like for example eight o'clock in the morning Uh 4 30 p.m. Just before they go home because everyone's kind of a bit lazy They're checked out by that point and also during lunch is is a good time for for social media And finally highlight engage with customers. This is this is something that um, oops. Sorry. I didn't even go through here I was clicking the wrong computer. I'm sorry about that So highlight engage with customers. Um This is one of the unique things about social media and the reason why I brought it up Most push marketing of course is just broad base like if you send something through tv It's not like child in the chakra factory where you can interact with the customer afterwards, right? You kind of just sit it out there and hope it's like a billboard But the thing is with social media marketing, of course is when you push something out You're able to get a response and it's really important that when you do get a response Put some effort into responding back because it's actually the most powerful way to demonstrate the core message of your brand now in terms of like what I mean by that is This adds an element of what I call social proofing. Okay It's much more powerful to show or demonstrate why you are or you do what you do Rather than just telling people because that's what push marketing essentially does But it gives you the opportunity to demonstrate it. Okay All right. Also people love a bit of free promotion. So it's always great cool So that kind of takes care of social media marketing. The next thing I kind of want to go into is content marketing Um, so we're talking about sort of blogs and videos. I think there's a really big miss nomar especially like with like content marketing and Um, web press a lot of people are like, oh, I want to create content And so they start writing as many articles as they can. Okay, but the thing is like we recently kind of did a review of Google's search policies around, you know, search engine optimization How they rank, you know websites for, you know, relevance and importance Actually turns out that it's not necessarily content. It's just general domain authority So when we talk about content marketing, we should not only be talking about the standard things like blogs and videos, etc Um, but also things like for example, guest posts or guest spots on podcasts or like speaking agents like this, you know Or, you know, like uh, say for example creating memes even like that That is a that is a genuine way of creating like good content marketing 78 percent of consumers trust brands that publish their own content Okay, and if you're just relying on kind of written content that becomes really kind of state So you want to be like really varied in the way, um that you kind of develop that need in people Okay into any way All right so And one of the ways that I like to Whenever I write sort of content or whenever I create content is to answer these kind of five questions Something like an acronym that I try and remember for myself.  That's like not not just polished like sometimes raw content is really awesome It's shareable. So it's able to help others and help others build their own brands And story driven that's really important as well a lot of people forget like you do a listicle There's not a whole lot of story in that but it's you know Being story driven builds that engagement and finally it's authoritative because that's what google looks at Do you know what you're talking about? Do other people think you know what you're talking about? Are you a trusted source? Okay so one of the things I kind of like like talking about is kind of um, we call it like There's a concept called the content hacker. I kind of read about this sort of on another website, but like basically What you want to look for I guess In creating content apart from like answering and to answer these questions First thing I would say is like look for a fit. Okay, and that answers the question of being targeted So it's like understand your customer. What do they want to see? It's very different You know to say creating location specific content for let's say ar of video games or something If Let's say your target market like you suddenly start like sending it to I don't know geriatrics care kind of facilities It doesn't work, right? So you need to understand that you need to think about how this is going to grow your business and not just simply add To a pile of content that never gets read Thirdly you need to think okay. What is the current market trend? Is there an opportunity for me to add value? Is it something that you know? I can demonstrate expertise in and rapidly build that authority that google is going to refer back to You also want to basically be able to create sustainable content A lot of people I find when they create content Especially if they're not following like a specific content strategy Is that they're going to create really specific pieces of content that are time bound and then after that time It's like hey, I can't use this anymore. I'm going to delete it or I'm just going to Do somewhere else, right?  So for example, so make sure that you know, you're able to Understand, you know, how google is understanding your your content and format it for that I think that's about it Next thing I want to kind of go into is each of these steps in terms of targeting Now in terms of like targeting I've kind of talked Oh, it's really important to understand your audience and stuff like that But what are some tools you can use to do that with And so something that you might want to look at and I typically use like kind of a Startup methodology when I come to sort of iterating my content That is you hypothesize something that you feel that your target audience might like You test it by writing some articles and see what sort of response you get and then to iterate But in order to be able to iterate and understand what sort of response you're getting You need these kind of tools. So one of the things I typically recommend is monster insights It's a really good analytics solution. Just generate, you know, it just generates data from google analytics And you're able to really easily understand, you know, what is resonating with your customer and so you can just do more of that Okay It adds a dashboard that shows sort of where people are coming from to consume your content So it gives you a good idea of the channels that you're using and how effective they are And it also comes with our we commerce tracking as well So anyone using e-commerce that that helps because you understand how people are kind of moving from there to cut The other one I kind of just brought up is Is exact metrics, okay, so they're a little bit more I would say comprehensive And that's another one you want to kind of check out as an option Oh, sorry. I talk really fast. My apologies So the first one is monster insights, okay They're the ones that make I think it's a google analytics dashboard for wordpress But monster insights you look that up. You should be able to find it And the other one is called exact metrics one word Okay, cool right, so The other thing I kind of want to get into it's really brief but effectively like There's no point creating content if no one reads it, right? And I really hate sort of clickbaity content But headings do matter, okay It's the thing it impacts your seo significantly and so without a great title no one's going to read it And so your content is kind of pointless this um title here The reason why I brought it out is everyone knows the onion. It's kind of that Yeah, yeah, see a lot of nodding heads. This is one of the first Titles that they created kind of sparked the direction of the entire Kind of publication and the way that they approach their Content Okay, so titles are really powerful The second thing I want to say of course we're talking about sharing before you want to encourage sharing and engagement from your users So for example one of the tools you may want to look at It's called sassy sassy social share one of the other things I would also recommend I come from sort of that like I said the engineering background these kind of tools They can be a little bit heavy on your site. So make sure you kind of vet it Make sure you have a sort of performance budget So you understand how it's impacting your site's performance when you add these and kind of measure before and after And then determine is this going to be worthwhile versus sort of the performance impact it's going to give So you can see like there's a ton of options. It supports heaps of social media kind of channels It supports that social share counting thing that creates that element of social proofing and like many other kind of social media plugins you're able to Use third party services to retrieve those stats And then also like I was talking about story driven One of the I guess misnomers about story driven is a lot of times when I talk when people when I say story driven A lot of people think okay, I need to paint like a narrative, you know of you know, whatever a thing I'm doing Oftentimes it's simpler than that. So for example one one kind of personal example that I have is when I was in Singapore and I was working in an accelerator One of the really really effective ways that one of the other startups that I was working alongside Was able to kind of reach their audience and really grow exponentially to create like a developer diary So they ended up just like creating a diary of their own experiences Writing it as if they were just talking to themselves But actually sharing it with the world and through that it actually created a lot of value for other people Who in sort of a similar situation kind of developing products Even if they'll just develop as they weren't actually working on a startup and actually generated a lot of interest in his own His own startup himself his own brand. And so don't just think about Like ways you can create narratives and just target it to the customer Think about your own personal narrative think about the way that you know You have come to the brand yourself You have come to create your own business and illustrate that for the customer as well Because that's often more more interesting than anything else you can formulate Also One thing longer is better Develop domain authority. So there's a lot of obviously articles out there who talk about hey keep to 600 words or something like that And that sort of thing is kind of becoming less and less valuable As I mentioned earlier content is really exploding To really get domain authority now to google to get google to really respect what you do You have to really develop expertise in a niche and you have to demonstrate it You can't simply write 600 word articles on like a range of things unless you're like buzzfeed Okay, and so what that means is and I did like some research around this Neil Patel did a study on this as well, you know, he found that for search related articles The top 10 Articles in sort of I think he did like something like 90 different searches or something like that The ones that ranked in the top 10 were typically 2000 words on average Okay, so the big takeaway is that content rich sites with really really niche domain authority are the ones that are found Most useful by google and typically most useful by the people who use it as well Okay, so make sure you put that effort in again. You want to think about sustainability these kind of articles You want to be able to reuse them. It's no use kind of creating a 2000 word article that only lasts for a week, right? So there's that consideration you have to put into account Okay, so we get into sort of some of the meat of this So the next thing I kind of want to talk about is a lead qualification notice So we've already talked about, you know building awareness Generating interest in your brand. How do you now get that interest into a form where you're able to I guess capitalize on it. You know what I mean? It's a business right here to make money And so one thing to keep in mind is of course, we're in a digital age So customers are more educated than ever And so you want to make sure that you're not simply just selling whatever service you're creating You want to be consultative in the way that you reach your customers You want to understand what their problems are and you want to be able to like directly talk to them Okay, so I'm going to go through a few things that goes into that first thing I want to go into is CRM's who uses a CRM at the moment with their business Oh That's less than I expected Cool, so CRM stands for customer relationship management kind of takes over kind of that role of How can I say your diary, you know oftentimes if you're running around as sort of a freelancer Or you're running around as a small business like trying to keep track of all the interactions You have with all the customers is a mind-boggling affair And so you want to be able to offload that and that's what CRM is able to do They're called client client relationship management tools so Just a few stats just to indicate how important these things are and why they're so ubiquitous in larger organizations Without a CRM part always found that 79 percent of leads failed to convert which is a huge amount. Okay Based on the compounded annual growth rate that businesses receive from implementing a CRM Average compound annual growth rate is 15.1. It's pretty high And for implementing a CRM The typical business sees a return on investment of five dollars per dollar invested. So it's a pretty high value activity Okay All right, so let's talk about like how you manage these like once you've implemented a CRM How do you manage that? Okay, so the first thing is you you let's say we're talking about nurturing the lead The first thing you want to understand is let's say someone's put in A contact form inquiry, right and you've got that through to your inbox You want to make sure that you Respond to that immediately and the reason why I say this is it's not because like, you know Like that's just the right thing to do as I mentioned The market nowadays is really saturated. So it's likely that this person has submitted a contact form to you know A number of other businesses inside sales has found that you know 35 to 50 percent of sales that go to 35 to 55 percent of sales actually go to the vendor that responds first So oftentimes just being first to respond wins you the deal Which is pretty weird HubSpot also found that the longer you take to respond To that inquiry the less the exponentially less likely you're going to get that deal The second thing is maintaining constant contact. Okay, and so there was a study done by genius.com about consistent contact with customers and they found that When they surveyed buyers Buyers indicated that or 66 percent of the buyers indicated that consistent and relevant communication provided by the sales and marketing organizations of a company Were a key influence in helping them decide what sort of solution they want to help grow their own business And so you want to make sure that you capture every lead that you can you make sure you like contact them on a regular basis They don't fall through the cracks because two-thirds of the time that is what actually leads to you losing out Third thing as I mentioned you want to be consultative too often And this especially comes from that transition from push marketing to pull marketing We just kind of featureless, you know, if someone says hey, I have a problem. You just great. I can fix it. Look at this 5 000 things to use right, but you're not really understanding what their problem is you haven't you haven't talked to them you haven't kind of like Drilled into it and kind of pulled it apart and that means like you haven't been able to really provide value You know and so you want to be able to to do that Sort of obviously in a scalable way and one of the scalable ways of being able to do that Is kind of using something called sort of drip campaigns You want to be able to nurture them through let's say email or a number of different channels drip campaigns have evolved from emails And you want to understand like there are two questions that I typically like to understand It's like what are the challenges are they facing? Okay, and what are the questions are they asking about the solution instead of trying to go here's some features They're awesome This is great because it allows you to set up like when you eventually do actually like meet them or have a meeting with them Or you actually talk to them. You're able to have a much warmer conversation. You have some context. Okay The last thing I would say is of course You want to be able to create advocates even if you don't win over their business Being professional being able to conduct your business in a way where you're creating value for this customer Even if they find your product is not a fit they will tell other people about your product And this is the most powerful way of generating business. It creates a network effect And so even though let's say, you know, someone has kind of From a from a lead or lead nurturing perspective One way you can do this is instead of simply cutting off communication Put them into a marketing nurture sort of campaign or something like that Constantly reach out to them about sort of new developments Sort of say events that you're holding or whether you'll be in town and stuff Even if they're not going to be across to grab a coffee with them, you know people love that All right, this actually goes into CRM next.  That's all cool So, um, I will I will probably Skip this one for now Okay, awesome. Oh cool. So this is kind of the last step. Um, we're getting to the end of our time anyway So this is good. Um, so we're talking about automating it now. So we've already talked about, okay How do we generate awareness? How do we build that interest? And then how do we nurture that lead? Let's say you start to get busy. You start to grow It gets really hard to do all of those steps in a way, you know, that's scalable Especially if you're kind of doing them by hand So some of the ways you can kind of win this process is by using WordPress because WordPress is so powerful with kind of that Native REST API It allows you to basically use so many different tools that you're able to kind of automate a lot of that process. So Basically, we've already gone into the funnel. So I don't need to really review in that Okay, um Let's see so some of the things that I like to do Basically, there is about As Michael said over 50,000 plugins that you can kind of leverage for WordPress So which one of the plugins are going to work for you? And also because there's a REST API as well There's a number of other things that you can connect with it that don't need to be a plugin A couple of the tools that I like to use just as a preface before I get into the actual recipe itself That are really simple to leverage and don't require a whole lot of knowledge and expertise to get working One's called Zappier. Okay, it's that What can I say it's that little like Eight sided star with a white circle in the middle and also if it's or if this then that Okay, and these are like they're not enterprise grade, but you know, like they're super easy to get going Okay, I recommend you have a look at them. All right, cool This is the cool bit. Okay. So this is what I like to call a really basic automation recipe Okay, it's something that like anyone can get going really easily It doesn't rely on any sort of tools that require a high level of expertise But it does allow you to be super effective in the way that you kind of not only build awareness Create interest but also kind of nurture those leads and build growth In sales or your business. So the first thing I would say is everything kind of hinges on content. Okay So we start with WordPress the bottom left hand corner and so when you publish that WordPress content Maybe on that WordPress content You want to put something like wb forms in there to be to be able to capture leads directly on the page But also not everyone's going to go to that web page, right? So you need to exploit other channels as well So something like a tool that I like using is called buffer. I'm not sure if anyone here uses Does anyone use buffer at the moment? four five six people awesome The reason why I like using buffer is it's super simple to use. You don't need to worry about creating a big ass, you know Annual marketing campaign calendar or anything like that. You just set it on an ongoing basis So you can say, okay Every like two times a day publish whatever is next on the feed, you know that sort of thing And you want to be able to push them through to the particular channels or social media channels that are applicable to you Of course facebook one of the biggest ones out there Instagram is another one that integrates with buffer and of course linked in if you're doing anything That's b2b related All right, awesome. And that basically funnels people back into the website now once someone has submitted their details into the contact form using something like zappier. You can push it into Straight into something like mailchimp or if you want to use an inpatine There's actually a tool called I believe it's called crm for wordpress that actually converts A wordpress install into a crm so it allows you to manage everything within wordpress So that can be like a separate install that you kind of push it into and then from mailchimp mailchimp has a huge number of integrations itself What I like to do is um, you want to basically They've already or they've already viewed your contact on say less what I call invasive channels. Okay Now you want to kind of leverage some of the more, uh, I guess Closer channels to the customer. Of course email is a really simple one mailchimp already handles that But you also want to leverage sms I believe there's already been studies done that typically about 70% of people when they receive an sms will engage with it It's just an innate sort of human thing. You see that little red dot on your phone You want to look at it, right? And so a platform that works really well is called twilio that I recommend everyone check out It actually is enterprise grade a lot of companies use that for their own sms platform Okay, but it's super simple to use so you can check that out Another one you might want to look at is engage bark, which is a little bit cheaper um another really Good quirk that I like using in the particular funnels that I use is That little tool down there. It looks like an x in a A box. It's called x.ai. It's actually a startup that developed An artificial intelligence scheduling bot. Okay the base start of san francisco and what it does it it actually um scans the emails and it actually communicates with your custom automatically to schedule time for you to be able to give them a call Okay, so you know those times where you spend time kind of sending emails going i'm available for they're like i'm not available at Four how about five i'm not available at five that sort of thing that is taken entirely out of your scope And you can actually build it that into each step within your drip marketing campaign That allows you to push people through the process towards sale without you ever being involved And then finally x.ai basically puts an appointment in your calendar for you to be able to talk to the customer And that that brings me to the end of that recipe Okay, so hopefully through this presentation. You've kind of gotten a base understanding of creating awareness Building interest in the particular brand that you have and then also nurturing that lead But then also using those that kind of knowledge or those kind of tools And putting that into an automated recipe so you can kind of get really efficient In the way that you engage with people and only deal with sort of the the stuff that's really high value So you can really accelerate the growth of your business All right, that brings me to the end Of my very impromptu presentation Do you have any questions No, oh, I was hoping no one put their hand on That was really good. Thank you. Um, I didn't quite get the name of the sms um twilio So it's spelled twilio Yeah, yeah, it's super handy I'm going to ask a massive favor that we get some links to those logos Oh, sure. We can do that later. This content's all going to be available later. It's been filmed. Um, so we will get some reference there I can do it can do How you doing good. Thanks. Sorry. What's your name? Ian. Ian. Nice to meet you. Thanks. Um You had a picture there of onion. Yep that newspaper. Yep, didn't get you drift there with the words that were Blanked out. I knew what they were Oh, yeah, they told me that they're naughty. So I can't put them up. Were you Putting it up as a good example or a bad example That one that's a good example because it allowed you to contemplate it and understand it sometimes Um, uh, it's not necessarily about the the content within the the title It's the fact that you reacted to it. So that was a really good.  Yeah Do you have any specific recommendations for wordpress plugins that connect with buffer? There was a little icon there, but sure, um I believe There already is an integration Between buffer and wordpress, but I'll double check that afterwards Anyone else guys? All right, well, let's call it then big round of applause again


Now, hundreds of supporters of South Africa's Jacob Zuma gathered to greet the former president in his hometown of Nkandla on Saturday, a sure force against a court decision to jail him for 15 months for failing to appear at a corruption inquiry. The constitutional court on Tuesday gave Zuma 15 months in jail for absconding in February from the inquiry led by Deputy Chief Justice Raymond Zondo. Zuma has until the end of Sunday to present himself to the police after which they have lodged to arrest him. They can give Zuma 15 months, they can give Zuma 24 months or they can give Zuma 100 months. He's not going to even serve one day or one minute of that.  They are not going to lay their hands on Zuma over my dead body.