# Auto-power switch for router?

**URL:** https://forums.maslowcnc.com/t/auto-power-switch-for-router/406
**Category:** Technical Details
**Created:** [August 7, 2017, 7:04pm UTC](https://forums.maslowcnc.com/t/auto-power-switch-for-router/406 "2017-08-07T19:04:36Z")
**Posts on this page:** 1
**Showing post:** 82

<div class="post-metadata">

### Author: ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)
#### Post date: [November 17, 2017, 6:21pm UTC](https://forums.maslowcnc.com/t/auto-power-switch-for-router/406/82 "2017-11-17T18:21:33Z")

</div>

The gcodes in the ‘M’ family are decoded in CNC\_Functions.h starting around line 1647 in ‘executeMcodeLine()’.  
Codes 0, 1, 2, 3, 4, 5, 6 and 30 are implemented.  
0 - program pause  
1 - optional pause/halt/stop  
2 - program end  
3 - spindle on - clockwise  
4 - spindle on counterclockwise (here, same as #3)  
5 - spindle off  
6 - tool change, pause for response  
30 - program end with return to top

3 & 4 turn the spindle on, 2, 5, 6 & 30 turn it off.

---

_[View the full topic](https://forums.maslowcnc.com/t/auto-power-switch-for-router/406)._
