Skip to content

Commit

Permalink
convert print to message
Browse files Browse the repository at this point in the history
  • Loading branch information
mnr committed Apr 25, 2024
1 parent d83c0fc commit bf0a015
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/rpi_pwm.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ rpi_pwm <- function(pin_number = 12, pwm_period = 50000, pwm_dutycycle = 25000,
if (!any(grepl(dtoverlayString, readLines("/boot/config.txt")))) {

# dtoverlayString contains the string to place in /boot/config.txt
print(paste("Add this string to /boot/config:", dtoverlayString))
print("Refer to https://mnr.github.io/rpigpior/articles/rpi_pwm.html#handling-errors")
message(paste("Add this string to /boot/config:", dtoverlayString))
message("Refer to https://mnr.github.io/rpigpior/articles/rpi_pwm.html#handling-errors")

stop(paste("PWM not enabled")) }
}
Expand Down Expand Up @@ -121,7 +121,7 @@ rpi_pwm <- function(pin_number = 12, pwm_period = 50000, pwm_dutycycle = 25000,
"/period"
)
system(gpio_sysCall, intern = TRUE)
if(pwm_debug) print(gpio_sysCall)
if(pwm_debug) message(gpio_sysCall)

# sudo echo 25000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
gpio_sysCall <- paste0("sudo echo ",
Expand All @@ -131,15 +131,15 @@ rpi_pwm <- function(pin_number = 12, pwm_period = 50000, pwm_dutycycle = 25000,
"/duty_cycle"
)
system(gpio_sysCall, intern = TRUE)
if(pwm_debug) print(gpio_sysCall)
if(pwm_debug) message(gpio_sysCall)

# sudo echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
gpio_sysCall <- paste0("sudo echo 1 > /sys/class/pwm/pwmchip0/pwm",
rpigpior::rpi_pin_desc[aPin,"PWM_channel"],
"/enable"
)
system(gpio_sysCall, intern = TRUE)
if(pwm_debug) print(gpio_sysCall)
if(pwm_debug) message(gpio_sysCall)

}
} # end of rpi_pwm
Expand Down
16 changes: 16 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
citHeader("To cite rpigpior in publications use:")

citEntry(
entry = "Article",
title = ,
author = ,
journal = ,
year = ,
volume = ,
number = ,
pages = ,
url = ,
textVersion = paste(

)
)

0 comments on commit bf0a015

Please sign in to comment.